I have to minify my html and add it in the minified js as an innerHtml. Currently, I am running the following grunt task and manually copying the minified html to the JS file. But , how can I get the minified html as an output and put that inside js, so that I can do all the task in single run.
module.exports = function(grunt) {
grunt.initConfig({
concat: {
css: {
src: ['src/css/style.css',...],
dest: 'dest/css/main.css'
},
js: {
src: ['src/js/angular.min.js',...],
dest: 'dest/js/main.js'
}
},
uglify: {
js: {
src: 'dest/js/main.js',
dest: 'dest/js/main.min.js'
}
},
cssmin: {
css: {
src: 'dest/css/main.css',
dest: 'dest/css/main.min.css'
}
},
minifyHtml: {
options: {
cdata: true
},
dist: {
files: {
'dest/html/index.html': 'src/html/index.html'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-minify-html');
grunt.registerTask('build', ['concat', 'uglify', 'cssmin','minifyHtml']);
};
Have you tried grunt-contrib-copy? Here is what my task looks like:
npm install grunt-contrib-copy