Compass "watch" docker container
Based on https://github.com/antonienko/compass-watch-docker-container but using Alpine Linux instead of Ubuntu.
The purpose is to compile sass or scss files using the compass open-source CSS Authoring Framework
Developed as an addition to Docker4Drupal and intended to be left running on your development machine, so every changes to sass sources, CSS will be compiled to the output folder you configure in the config.rb file.
How to use this image
First, you need to configure your folders in a config.rb file, placed on the sass root folder. Here's an example folder structure, and its corresponding config.rb file.
/src /compass /sass config.rb /app /public /css
# Require any additional compass plugins here. #Folder settings css_dir = "../public/css" #where the CSS will saved sass_dir = "sass" #where our .scss files are images_dir = "../public/img" #the folder with your images # You can select your preferred output style here (can be overridden via the command line): output_style = :expanded # After dev :compressed # To disable debugging comments that display the original location of your selectors. Uncomment: line_comments = true # Obviously preferred_syntax = :scss
Note I was unable to get additional compass plugins to load so I have baked in the ones I required to the Dockerfile
Manual CSS Compilation
docker run -v $(pwd):/src dedavidson/compass-watch compile /src/some-folder/another-folder --force
Watching for sass Changes
Using docker run
docker run -d -v /src:/src dedavidson/compass-watch watch --poll /src/compass
Using docker compose
compass: build: dedavidson/compass-watch command: watch --poll /src/compass volumes: - /src:/src