DEPRECATED
Build JS on Federalist
This is a standalone test of an idea that Brian and I cooked up for EITI, in which we use a Jekyll plugin to fire off a production build (using WebPack in this case, but it could be anything) of our JavaScript in the Federalist build container. That way, we can keep minified JS out of version control (which inevitably causes merge conflicts, as in College Scorecard) and have production JS built on specific branches.
Here's how it works:
- Our Jekyll plugin, _plugins/build.rb,
compares the
BRANCH
environment variable (set by Federalist during a build) to a list of known "production" branches. - If the branch is in our production list, we set
ENV['NODE_ENV'] = 'production'
and build the JavaScript withnpm install && npm run build
. - Our npm
build
script callswebpack
. - Our webpack config conditionally uglifies the JavaScript if
process.env.NODE_ENV === 'production'
.
You can see the results built by Federalist here.