2021-08-17 21:08:01 +00:00
|
|
|
# docker-node-sass
|
|
|
|
|
2021-08-17 21:19:32 +00:00
|
|
|
[![Build Status](https://drone.autonomic.zone/api/badges/3wordchant/docker-node-sass/status.svg)](https://drone.autonomic.zone/3wordchant/docker-node-sass)
|
2021-08-17 21:26:58 +00:00
|
|
|
[![](https://img.shields.io/docker/v/3wordchant/node-sass)](https://hub.docker.com/r/3wordchant/node-sass/)
|
2021-08-17 21:19:32 +00:00
|
|
|
|
2021-08-17 21:08:01 +00:00
|
|
|
Docker image for node-sass, based on this blog post:
|
|
|
|
http://johnbokma.com/blog/2021/06/17/a-docker-image-for-sass.html
|
|
|
|
|
|
|
|
## Run with Docker
|
|
|
|
|
|
|
|
`docker run -v "$(pwd):/data" 3wordchant/node-sass main.scss`
|
|
|
|
|
|
|
|
`-v ...` mounts the current directory into the `/data` directory, which is where
|
|
|
|
`sass` will look for files. If your SCSS files are elsewhere, you can change or
|
|
|
|
add to `"$(pwd)"`
|
|
|
|
|
|
|
|
Everything after `3wordchant/node-sass` is an argument to the Sass compiler. See
|
|
|
|
all available options by running `... 3wordchant/node-sass --help`.
|
|
|
|
|
|
|
|
In particular, the `-w` "watch" option might be helpful, e.g.:
|
|
|
|
|
|
|
|
`docker run -v "$(pwd):/data" 3wordchant/node-sass -w main.scss main.css`
|
|
|
|
|
|
|
|
will watch for changes to `main.scss` or its dependencies, and compile them to
|
|
|
|
`main.css`.
|
|
|
|
|
|
|
|
## Run with docker-compose / Docker Swarm-mode
|
|
|
|
|
|
|
|
```
|
|
|
|
services:
|
|
|
|
sass:
|
|
|
|
image: 3wordchant/node-sass
|
|
|
|
volumes:
|
|
|
|
- "../path/to/assets:/data"
|
|
|
|
command: ["-w", "scss/main.scss", "css/main.css"]
|
|
|
|
```
|
|
|
|
|
|
|
|
You can also then run one-off commands with `docker-compose exec sass ...`.
|