grunt-inlines
grunt-inlines helps you insert code which have been minified inline your file, it supports css and html files.
Usage
In your Gruntfile.js, write like below:
inlines: options: cssmin: true htmlmin: true htmlminOptions: // Please references https://www.npmjs.com/package/html-minifier#options-quick-reference files: src: ... dist: ...
then, you can invoke function __inline in your javascript file, just like this:
// demo.js// be sure that ./css/style.css existsvar styleCSS = var template =
and ./css/style.css file's content is:
and ./html/footer.html file's content is:
this is footer
after compiled by grunt, demo.js would become:
var styleCSS = '.name{color:red}'var template = '<footer>this is footer</footer>'