Reduce development build time to < 2 seconds.#484
Reduce development build time to < 2 seconds.#484qvm1Wak wants to merge 2 commits intodashpay:masterfrom
Conversation
…ly several minutes) - disables images by overriding the ruby plugin - disables i18n with jekyll config override - excludes more directories with jekyll config override - new npm run targets - commit hook to prevent committing overrides - a full build is still required for pre-commit - removed duplicate run target for "validate"
|
Thanks for your contribution, @qvm1Wak ! This has been a thorn in our side for a while, and while I personally modified my own workspace last year to do what you're describing, I did not implement it in such a way that was reusable for others. If you're interested - it might be nice to put a switch in that additionally disables the multi-language outputs - that speeds it up (if I recall correctly) as well. Also - did you try using the incremental build at all? Is that working for you while developing? It seemed to be very quick for me in that it executes an initial build (takes a while) then detects changes and builds only what is affected by your changes (my understanding). I used it with much success. @tungfa can we get a web-team member to review this PR? |
|
Thanks for the tips @chuckwilliams37 ! I'll see what I can do with incremental, I've never really used it. I had some luck with disabling languages.. was able to exclude the language folder and set yml overrides to just compile English pages. There's now a separate _config-dev.yml where you can select subsets of things to build. |
| }, | ||
| "jshintConfig": {}, | ||
| "pre-commit": [ | ||
| "check:dev-override", |
There was a problem hiding this comment.
Could you please delete this line from pre commit? And the rest is fine.
I noticed the compile time for the website was pretty slow, so I spent some time making it faster! Developers need to see changes as soon as possible between edits, and on my machine the build time was around two minutes, and sometimes over five minutes.
To get the build time down, I made the build do less. Specifically, disabling responsive image generation, building only one i18n locale (en), and excluding large irrelevant folders that weren't already excluded.
In bullets:
The only way I could figure out how to disable images was by making a stub Liquid interface in Ruby (in the _plugins folder). Overriding the existing plugin with the stub one saves 30-60 seconds of build time, but at the cost that you might accidentally check that override in. So there's another pre-commit check to verify you didn't do that. In the long run we might try to extract the responsive image logic so it's not so tied to Jekyll.
Jekyll is also working on logic such that includes override excludes so you can work on just a page or two at a time, but that's not ready yet. This PR continues to build all pages, but you're free to change that as you work.
Pre-commit still requires a full build of everything, just to be safe. I'm not sure if this is necessary as CI could catch those issues without slowing devs too much.
Steven
Edits: Grammar, image asset copy note