Skip to content

Instantly share code, notes, and snippets.

@efleming969
Created December 16, 2020 18:42
Show Gist options
  • Save efleming969/b1ff012568481de42c8b34f697fb1d97 to your computer and use it in GitHub Desktop.
Save efleming969/b1ff012568481de42c8b34f697fb1d97 to your computer and use it in GitHub Desktop.
const Fs = require('fs');
const Cheerio = require('cheerio');
/*
* This script simply extracts the head and body content from react-scritps
* production build and puts them in separate files for teamraiser
* pagewrapper
*/
const content = Fs.readFileSync('./build/index.html', 'utf-8');
const $ = Cheerio.load(content);
const head = $('head');
Fs.writeFileSync('./build/head.html', head.html(), 'utf-8');
const body = $('body');
Fs.writeFileSync('./build/body.html', body.html(), 'utf-8');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment