Question

Setting up a Gitlab Hook to autocompile SASS

Hi there,

I’m just wondering if someone ever set up a hook within gitlab to autocompile SASS as soon as a push has been done. If so, I would gladly appreciate any hint on how you did it or if there is better way to compile pushed SASS.

Kind Regards

Subscribe
Share

Rather than reinventing the wheel, here you go:

Jenkins Gitlab plugin


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Check out the docs from GitLab on how to configure custom git hooks. This would need to be done by an administrator as you need filesystem access. If you used the DigitalOcean One-Click or GitLab’s Omnibus installer, you can find the git repository in disk at:

/var/opt/gitlab/git-data/repositories/<group>/<project>.git

Inside of that directory, you can create a new directory named custom_hooks In there, you can create and use normal git hooks. For instance if you wanted to run a script to compile SASS after a push, you could use a post-receive hook.

You’ll also need to make sure the directory is owned by the git user:

chown -R git:git /var/opt/gitlab/git-data/repositories/<group>/<project>.git/custom_hooks

For more info on writing git hooks, check out: