Closed JamesChevalier closed 8 years ago
This needs some better description! Specifically I need to figure out how to better explain this and make it runnable for everyone.
The gist is that, for the Mapbox use case, the build
script only runs in the build phase. We have a service that works a lot like GitHub Pages but it also runs npm install & npm run build
- so for a bunch of projects, we use npm scripts to do our build processes and avoid commiting any 'dist' or built files to the repository. So the APP
hack is geared for that and is the simplest possible solution.
I think writing a re-runnable script is possible by replacing the APP string-replace with, for instance, <!-- start -->
and end comments that wouldn't be overwritten by the rendering process.
In my experience so far, the build script is not overwriting the
index.html
file after its first run (so, the first run does overwrite theindex.html
file).I think the cause is that the
render.js
file is looking to specifically overwrite the instance of APP in theindex.html
file. The problem seems to be that the first run of thebuild
script replacesAPP
with the compiled contents of the markdown files, so subsequent attempts to replaceAPP
can't succeed.I've gotten around this by changing the build script to output to a different file:
I can't really rationalize why that works, though, since the
release.html
file doesn't includeAPP
either. ¯_(ツ)_/¯Assuming I'm not just doing something/everything wrong, can I provide any more information or run any particular tests to help you with this?