Refactor Gulp tasks into dev & build
taylorbryant opened this issue · comments
Right now, there is only the default task. On save, every single task and optimization is run. I'd like to break out the task into separate dev and build tasks.
The dev task wouldn't minify, run autoprefixer, or remove unused CSS. With the current setup, there's extraneous steps that unnecessarily prolong build time.
I've used this repo as a starter for a site I'm doing. I've managed to get it to deploy on Netlify without modifying the gulpfile using jekyll build && gulp css jekyll-build
as a build command.
It's a total hack (I know) but hey, it works ¯_(ツ)_/¯.
@lukebennett88 Hey, thanks for commenting. I hope you like it!
An easier way you could do that is to add the following to your package.json
:
"scripts": {
"build": "gulp css"
}
Then, in Netlify, change your build command to npm run build
.
The way I had to set up the Gulpfile is kind of confusing 🤷♂️, but running css
will actually call jekyll-build
before doing anything.
Hopefully that makes sense! I went ahead and added some npm scripts to this repo to make it easier for people in the future. 🎉
Hey Taylor, thank you so much, and yes I do like it 😊
Just tried this, and I think the gulpfile might still need some tweaking — if you try to run npm run build
without already having a _site
folder generated, the build fails. Here's the log if that's any help.
2018-04-26T22_54_52_311Z-debug.log
I managed to get it to work by appending jekyll build &&
to my build command (looks like the jekyll-build
at the end may have been redundant though, whoops).
Cheers 🍻