Skip to content

Commit 998dfa5

Browse files
committed
added placeholders
webpack/react-starter#69
1 parent d13212d commit 998dfa5

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

lib/placeholdersLoader.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
MIT License http://www.opensource.org/licenses/mit-license.php
3+
Author Tobias Koppers @sokra
4+
*/
5+
var parseSource = require("./parseSource");
6+
var getPlaceholderIdent = require("./getPlaceholderIdent");
7+
8+
module.exports = function(content) {
9+
if(this.cacheable) this.cacheable();
10+
11+
var stuff = parseSource(content);
12+
13+
var placeholders = {};
14+
stuff.placeholders.forEach(function(placeholder) {
15+
if(!placeholders[placeholder.name]) {
16+
placeholders[placeholder.name] = getPlaceholderIdent(this, placeholder.name);
17+
}
18+
}, this);
19+
20+
return "module.exports = " + JSON.stringify(placeholders) + ";";
21+
};

placeholders.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/*
2+
MIT License http://www.opensource.org/licenses/mit-license.php
3+
Author Tobias Koppers @sokra
4+
*/
5+
module.exports = require("./lib/placeholdersLoader");

0 commit comments

Comments
 (0)