Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to pass in locals as a function
- Loading branch information
1 parent
b159e1b
commit 79eb95c
Showing
8 changed files
with
97 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'Foo'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function(locals) { | ||
return '<div>' + locals.chunks.join('<br />') + '</div>'; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var StaticSiteGeneratorPlugin = require('../../../'); | ||
var ejs = require('ejs'); | ||
var fs = require('fs'); | ||
|
||
var paths = ['/', '/foo', '/foo/bar']; | ||
|
||
module.exports = { | ||
entry: { | ||
bar: __dirname + '/bar.js', | ||
main: __dirname + '/index.js' | ||
}, | ||
|
||
output: { | ||
filename: '[name].js', | ||
path: __dirname + '/actual-output', | ||
publicPath: '/foo/', | ||
libraryTarget: 'umd' | ||
}, | ||
|
||
plugins: [ | ||
new StaticSiteGeneratorPlugin({ | ||
entry: 'main', | ||
locals: ({ path, webpackStats }) => ({ | ||
chunks: Object.keys(webpackStats.compilation.assets).map( | ||
file => `${webpackStats.compilation.outputOptions.publicPath}${file}` | ||
) | ||
}) | ||
}) | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters