Saturday, 15 March 2014

gruntjs - Yeoman Grunt HTMLMin copy all files in subdirectories to same folder structure in dist -



gruntjs - Yeoman Grunt HTMLMin copy all files in subdirectories to same folder structure in dist -

looking right regular expression(s) mirror folder construction "app" "dist" folder.

e.g. app/components/search/a.html app/components/search/b.html etc.

to: dist/components/search/a.html dist/components/search/b.html etc.

my current grunt htmlmin entry:

htmlmin: { dist: { options: { collapsewhitespace: true, collapsebooleanattributes: true, removecommentsfromcdata: true, removeoptionaltags: true }, files: { '<%= yeoman.dist %>/components/search' : '<%= yeoman.app %>/components/search/**/*.html' } } },

have tried several other combinations unsuccessfully.

turns out there pretty decent template doing in grunt file yeoman generate angular.

the yeoman generator directory style isn't quite wanted, default doesn't work. i've amended fit needs.

my solution:

htmlmin: { dist: { options: { collapsewhitespace: true, collapsebooleanattributes: true, removecommentsfromcdata: true, removeoptionaltags: true }, files: [ { expand: true, cwd: '<%= yeoman.app %>/components', src: '{,*/}*.html', dest: '<%= yeoman.dist %>/components' } ] } }

gruntjs yeoman grunt-contrib-htmlmin

No comments:

Post a Comment