npm install useref-fileUseref on a file
npm install useref-file
* inputFile - the HTML file to run useref on
* outputFile - resulting HTML file. The concatenated block files will be located relative to this file.
* options
* handlers - handlers for each type of block
* js - 'concat'|'uglify'|function (default: concat)
* css - 'concat'|'uglify'|function (default: concat)
* callback - function that will be called with (err, { blockType: { outputFile, outputData } })
useref inputFile outputFile --js
HTML file:
Javascript:
var userefFile = require('useref-file')
userefFile('index.html', 'build', { handlers: { js: 'uglify' }}, function(err, result) {
/*
{
js: {
{ outputFile: 'scripts/combined.concat.min.js', outputData: '...' },
{ outputFile: '/combined2.concat.min.js', outputData: '...' }
},
css: {
{ outputFile: '/css/combined.css', outputData: '...' },
{ outputFile: 'combined2.css', outputData: '...' }
}
*/
});
Support source maps