From 551c1f203ad7fcb2e517f69f8a87a5efba33f226 Mon Sep 17 00:00:00 2001 From: 3wc <3wc@doesthisthing.work> Date: Tue, 17 Aug 2021 23:08:01 +0200 Subject: [PATCH] =?UTF-8?q?Initial=20import=20=F0=9F=90=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 11 +++++++++++ README.md | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5f807f6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +# Syntax=docker/dockerfile:1 +FROM alpine:3.12 + +WORKDIR /app + +RUN apk add --no-cache npm \ + && npm install --global sass + +WORKDIR /data + +ENTRYPOINT ["npx", "sass"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..6d753c5 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# docker-node-sass + +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 ...`.