diff --git a/index.js b/index.js index 59bd3d0..483820f 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,8 @@ var fs = require('fs'); var modes = { 'expand': require('./modes/expand'), 'hash': require('./modes/hash'), - 'list': require('./modes/list') + 'list': require('./modes/list'), + 'custom': require('./modes/custom') }; module.exports = require('browserify-transform-tools').makeRequireTransform( diff --git a/modes/custom.js b/modes/custom.js new file mode 100644 index 0000000..59c222c --- /dev/null +++ b/modes/custom.js @@ -0,0 +1,10 @@ +module.exports = function(base, files, config) { + if (files.length === 0) { + return ''; + } + return files.reduce( + function(acc, file, idx, arr) { + var template = config.template.replace(new RegExp('{file}', 'g'), file); + return (acc ? acc + ";" : "") + template; + }, false); +};