Created
August 14, 2015 02:34
-
-
Save lenage/12c12230c65fb11d4d0e to your computer and use it in GitHub Desktop.
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
'use strict' | |
var jsonfile = require('jsonfile') | |
var replace = require('replace-in-file') | |
var fs = require('fs') | |
fs.readdir('dist', function(err, files) { | |
var htmlFiles = [] | |
files.forEach(function(x) { | |
if (/\.html$/.test(x)) { htmlFiles.push('dist/' + x) } | |
}) | |
jsonfile.readFile('dist/webpack-assets.json', function(err, obj) { | |
replace({ | |
files: htmlFiles, | |
replace: /assets\/bundle\.js/, | |
with: obj.main.js | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment