I’ve made some progress on this but I’m still becoming familiar with the Gulp build process myself. This actually works now but is a little rough around the edges and has a few caveats:
- I’m using the latest Sage 8.3.0
- Install necessary gulp modules using this cmd: https://gist.github.com/CFXd/e801388de55a9915e58f#file-gulp_module_installation
- Add JSON sitemap code to your
extras.php
: https://gist.github.com/CFXd/e801388de55a9915e58f#file-sitemap-php - Copy this into your
gulpfile.js
: https://gist.github.com/CFXd/e801388de55a9915e58f#file-gulpfile-js - Run
gulp --production
once - Uncomment the above
gulpfile.js
lines 105-109 - Run
gulp --production
again
I tested the above on a brand new installation and it worked like a charm, dropped my CSS from ~25kb down to ~2.5kb. Some caveats:
- It only works when running
gulp --production
task (as it should), however thesitemap.json
gets generated every time you run a gulp task, even withoutproduction
task specified. I’m not 1337 enough with gulp yet to get that sitemap only generating inproduction
task. - Obviously it would be nice if you didn’t have to start with a commented
gulpfile.js
section and then uncomment, but without that gulp spits out an error becausesitemap.json
doesn’t exist at first and it needs to be run once for it to be created. Again not 1337 enough to solve this one. - Would be even better if instead of generating a
sitemap.json
file gulp would just fetch the JSON sitemap as a stream and use that.
Any improvements and help with the caveats above would be awesome. I’d love to get an updated blog post out of this and will certainly credit anyone who wants to pitch in.
View a diff of the original gulpfile.js
right here
Enjoy and thanks for feedback & suggestions!