Hi, i’m using netlify for my Hugo web. My flow is local>gitlab repo>netlify.
On my local developement I’m using gulp to do some stuff like minify css & prettyfy HTML (add gulpfile.js and run the task manually after hugo build). The problem I have no idea how to implement the gulp task on the Netlify.
Is there anyone here have any experience how to run gulp task on netlify after hugo build.
I use the GitLab CI for building my site, so I’d include the gulp tasks there. Are you building the site on Netlify? I think their continuous deployment docs point out how to set up build commands.
Just a tip, the command doesn’t need to be just hugo.
I don’t know Gulp, so I do minification and cache busting on Netlify using a shell script. So the command that I set is ./build.sh.
So you can pack everything you need to do from the command line into that build script and simply call hugo in the end. You can even use a Makefile instead of a shell script, put that file in your repo root, and set command to make.
Or, maybe you are trying to do something in the build script that’s not allowed on Netlify. Best bet would be to put echo statements before each command in the script, and then figure out which step failed.
Personally I use the package.json scripts to build everything so I only give netlify the command: eenpm run whatever (providing the name of your script is whatever ;))
Then from inside package json build:
"scripts": {
"whatever": "grunt; hugo"
},
It avoids file permission issues.
I use grunt and not gulp but your get the idea. Netlify reads your package.json automatically and uses it to install dependencies.
Great! Sorry, I couldn’t help much with the gulp/npm stuff.
But I am still curious why the permissions thing didn’t get resolved. Just for anyone else facing this issue, and also not familiar with npm, etc., this should have worked (works on my end):
Ensure that your git repo is preserving file permissions… make sure you have this in your <REPO>/.git/config:
[core]
filemode = true
With the build script at <REPO>/build.sh, ensure that the script has a valid shebang header like #!/usr/bin/env bash, and the right permissions:
chmod 744 <REPO>/build.sh
Commit that build script… with the updated permissions.
Then, with command set to ./build.sh in Netlify, the build should work.
@Yudy_Ananda If you still have time, I am curious to know if these steps work for you
done step 1 change the git config and add shebang header on the step 2 and lastly set the command to ./build.sh in my netlify console but the result still the same bro