Skip to content

Instantly share code, notes, and snippets.

@lenage
Created August 14, 2015 02:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lenage/12c12230c65fb11d4d0e to your computer and use it in GitHub Desktop.
Save lenage/12c12230c65fb11d4d0e to your computer and use it in GitHub Desktop.
'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