Report this

What is the reason for this report?

Setting up a Gitlab Hook to autocompile SASS

Posted on June 9, 2015
HYST

By HYST

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



This textbox defaults to using Markdown to format your 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:

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.