Compare commits

...

3 Commits

Author SHA1 Message Date
rubenmoya
ba2bc6a885 Add default value to options 2018-06-15 15:12:43 +02:00
rubenmoya
9c8bb20f58 Create major version 2018-06-15 15:00:22 +02:00
rubenmoya
1e0d055cca Update for webpack 4 2018-06-15 09:27:01 +02:00
3 changed files with 10 additions and 2 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

View File

@ -1,7 +1,11 @@
var loaderUtils = require('loader-utils');
var _ = require('lodash'); var _ = require('lodash');
module.exports = function (source) { module.exports = function (source) {
this.cacheable && this.cacheable(); this.cacheable && this.cacheable();
var template = _.template(source, null, this.options.tplSettings);
var options = loaderUtils.getOptions(this) || {};
var template = _.template(source, null, options.tplSettings);
return 'var _ = require(\'underscore\');\nmodule.exports = ' + template; return 'var _ = require(\'underscore\');\nmodule.exports = ' + template;
}; };

View File

@ -1,6 +1,6 @@
{ {
"name": "tpl-loader", "name": "tpl-loader",
"version": "0.2.2", "version": "1.0.0",
"description": "Underscore Templates loader for webpack", "description": "Underscore Templates loader for webpack",
"main": "index.js", "main": "index.js",
"repository": { "repository": {
@ -28,5 +28,8 @@
"bump:major": "npm version major", "bump:major": "npm version major",
"bump:minor": "npm version minor", "bump:minor": "npm version minor",
"postversion": "git push origin master --follow-tags" "postversion": "git push origin master --follow-tags"
},
"dependencies": {
"loader-utils": "^1.1.0"
} }
} }