Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
'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
You can’t perform that action at this time.