Skip to content

Instantly share code, notes, and snippets.

@doowb
Created August 7, 2014 18:38
Show Gist options
  • Save doowb/1badb1098d1ec6986fb1 to your computer and use it in GitHub Desktop.
Save doowb/1badb1098d1ec6986fb1 to your computer and use it in GitHub Desktop.
custom naming in template-loader
var path = require('path');
var loader = require('./');
var base = path.resolve('test/fixtures');
var relative = path.relative.bind(path, base);
loader({
rename: function (filepath) {
var name = relative(filepath);
return name
.replace(path.extname(name), '')
.replace(/[\\\/]/g, '-');
}
})
.load('test/fixtures/**/*.*');
console.log('templates', loader.cache);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment