@@ -342,8 +342,22 @@ module.exports = function(grunt) {
342
342
dest : 'p5-reference/'
343
343
}
344
344
} ,
345
- htmllint : {
346
- all : {
345
+
346
+ htmlhint : {
347
+ html1 : {
348
+ options : {
349
+ 'attr-value-double-quotes' : false ,
350
+ 'alt-require' : true ,
351
+ 'doctype-first' : true ,
352
+ 'title-require' : true ,
353
+ 'attr-no-duplication' : true ,
354
+ 'input-requires-label' : true ,
355
+ 'tags-check' : true ,
356
+ 'tagname-lowercase' : true ,
357
+ 'tagname-specialchars' : true ,
358
+ 'empty-tag-not-self-closed' : true ,
359
+ 'id-unique' : true
360
+ } ,
347
361
src : [
348
362
'<%= config.dist %>/**/*.html' ,
349
363
'!<%= config.dist %>/**/CHANGES.html' ,
@@ -352,20 +366,13 @@ module.exports = function(grunt) {
352
366
'!<%= config.dist %>/**/learn/*.html' ,
353
367
'!<%= config.dist %>/**/examples/*.html' ,
354
368
'!<%= config.dist %>/**/reference/assets/index.html'
355
- ] ,
356
- options : {
357
- ignore : [
358
- / ^ T h i s d o c u m e n t a p p e a r s t o b e w r i t t e n i n E n g l i s h / ,
359
- / ^ B a d v a l u e “ h t t p s : / ,
360
- / ^ C o n s i d e r a d d i n g a “ l a n g ” a t t r i b u t e t o t h e “ h t m l ” / ,
361
- / ^ A t t r i b u t e “ p a y p a l e x p r e s s ” n o t a l l o w e d o n e l e m e n t “ s c r i p t ” a t t h i s p o i n t ./
362
- ]
363
- }
369
+ ]
364
370
}
365
371
} ,
372
+
366
373
shell : {
367
374
generate_dataJSON : {
368
- command : ' npm ci && npm run grunt yui' ,
375
+ command : `git checkout ${ grunt . option ( 'target' ) } && npm ci && npm run grunt yui build` ,
369
376
options : {
370
377
execOptions : {
371
378
cwd : 'tmp/p5.js'
@@ -378,7 +385,7 @@ module.exports = function(grunt) {
378
385
grunt . registerTask ( 'update-version' , function ( ) {
379
386
const done = this . async ( ) ;
380
387
381
- const version = require ( './src/templates/pages/reference/data.json ') . project . version ;
388
+ const version = grunt . option ( 'target ') . substring ( 1 ) ;
382
389
383
390
fs . readFile ( './src/data/data.yml' )
384
391
. then ( str => {
@@ -402,7 +409,7 @@ module.exports = function(grunt) {
402
409
grunt . loadNpmTasks ( 'grunt-file-append' ) ;
403
410
grunt . loadNpmTasks ( 'grunt-contrib-compress' ) ;
404
411
grunt . loadNpmTasks ( 'grunt-contrib-requirejs' ) ;
405
- grunt . loadNpmTasks ( 'grunt-html ' ) ;
412
+ grunt . loadNpmTasks ( 'grunt-htmlhint ' ) ;
406
413
407
414
// i18n tracking task
408
415
grunt . registerTask ( 'i18n' , function ( ) {
@@ -436,6 +443,14 @@ module.exports = function(grunt) {
436
443
// move the data.json files from the cloned p5.js repository to the p5.js-website repository
437
444
fse . moveSync ( dataJSON_p5js , dataJSON_p5jswebsite , { overwrite : true } ) ;
438
445
fse . moveSync ( dataJSONmin_p5js , dataJSONmin_p5jswebsite , { overwrite : true } ) ;
446
+
447
+ const p5min_src = 'tmp/p5.js/lib/p5.min.js' ;
448
+ const p5min_dest = 'src/assets/js/p5.min.js' ;
449
+ const p5Soundmin_src = 'tmp/p5.js/lib/addons/p5.sound.min.js' ;
450
+ const p5Soundmin_dest = 'src/assets/js/p5.sound.min.js' ;
451
+ fse . moveSync ( p5min_src , p5min_dest , { overwrite : true } ) ;
452
+ fse . moveSync ( p5Soundmin_src , p5Soundmin_dest , { overwrite : true } ) ;
453
+
439
454
// delete the tmp folder that contained the p5.js repository
440
455
fse . removeSync ( 'tmp/' ) ;
441
456
} ) ;
@@ -451,8 +466,8 @@ module.exports = function(grunt) {
451
466
'clone_p5js_repo' ,
452
467
'generate_dataJSON' ,
453
468
'move_dataJSON' ,
454
- 'generate_enJSON ' ,
455
- // 'json-to-fluent '
469
+ 'update-version ' ,
470
+ 'generate_enJSON '
456
471
] ) ;
457
472
458
473
// multi-tasks: collections of other tasks
@@ -476,19 +491,18 @@ module.exports = function(grunt) {
476
491
477
492
// runs tasks in order
478
493
grunt . registerTask ( 'build' , [
479
- 'update-version' ,
494
+ // 'update-version',
480
495
'exec' ,
481
496
'clean' ,
482
497
'requirejs:yuidoc_theme' ,
483
498
'requirejs' ,
484
- // 'fluent-to-json',
485
499
'copy' ,
486
500
'optimize' ,
487
501
'assemble' ,
488
502
'file_append' ,
489
503
'compress' ,
490
504
'i18n' ,
491
- 'htmllint '
505
+ 'htmlhint '
492
506
] ) ;
493
507
494
508
// runs with just grunt command
0 commit comments