Skip to content

Instantly share code, notes, and snippets.

@cjus
Last active June 12, 2018 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjus/21f9db7f1b924f0c24d4e7bc6360a573 to your computer and use it in GitHub Desktop.
Save cjus/21f9db7f1b924f0c24d4e7bc6360a573 to your computer and use it in GitHub Desktop.
Fixup file for Preact build
const fs = require('fs');
const path = require('path');
const packageJson = require('./package.json');
let filePath = path.join(__dirname, '/build/index.html');
let html = fs.readFileSync(filePath, 'utf8');
html = html.replace('<head>', `<head><base href="${packageJson.homepage}">`);
fs.writeFileSync('build/index.html', html);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment