Compile SASS Using GitLab Pipelines
Since using GitLab pipelines I have been committing the compiled css from my SASS files and then doing an rsync from GitLab CI in order to deploy the changes I make to my website, but this has always annoyed me as before I used to compile the SASS on the fly, but I have finally managed to make it work like so:
stages:
- compile
- deploy
compile:
stage: compile
image: node:8.15-alpine
script:
- yarn global add node-sass
- node-sass ./content/themes/carlin/assets/sass/input.scss ./content/themes/carlin/assets/css/screen.css --style compressed
only:
- master
artifacts:
paths:
- ./content/themes/carlin/assets/css
which you'd then use with your own deploy
stage.
The reason for using yarn is that I experienced issues trying to use npm.
The artifacts
makes the generated css file available in subsequent stages, nice!
Hope it helps someone.