Skip to content

Commit

Permalink
Merge pull request #8 from GusRuss89/master
Browse files Browse the repository at this point in the history
Make dot options available
  • Loading branch information
ross-pfahler committed Apr 9, 2018
2 parents 250d9ac + 4d12735 commit 91082bc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
8 changes: 7 additions & 1 deletion README.md
Expand Up @@ -15,7 +15,13 @@ var template = require("dot!./file.dot");
module.exports = {
module: {
loaders: [
{ test: /\.dot$/, loader: "dot-loader" }
{
test: /\.dot$/,
loader: "dot-loader",
options: {
// your custom dot options
}
}
]
}
};
Expand Down
7 changes: 5 additions & 2 deletions index.js
@@ -1,12 +1,15 @@
var dot = require('dot');
var fs = require('fs');
var loaderUtils = require('loader-utils');

module.exports = function(content) {
var options = loaderUtils.getOptions(this);
if (this.cacheable) {
this.cacheable();
}

dot.templateSettings.selfcontained = true;

options.selfcontained = true;
dot.templateSettings = Object.assign(dot.templateSettings, options);

var content = fs.readFileSync(this.resourcePath);
return "module.exports = " + dot.template(content);
Expand Down
14 changes: 8 additions & 6 deletions package.json
Expand Up @@ -5,12 +5,14 @@
"main": "index.js",
"version": "0.1.1",
"dependencies": {
"dot": "1.0.3"
"dot": "1.0.3",
"loader-utils": "^1.1.0"
},
"repository": "http://www.github.com/ross-pfahler/dot-loader",
"licenses": [{
"type": "MIT",
"url": "http://www.opensource.org/licenses/mit-license.php"
}]
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/mit-license.php"
}
]
}

1 comment on commit 91082bc

@Rainmen-xia
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which version of webpack need for this change?

Please sign in to comment.