How can I get SASS/Compass into the DDEV web container?

Viewed 565

A client needs Compass for SASS compilation inside the DDEV-Local web container. How can I get compass in there?

1 Answers

Compass requires ruby and rubygems, and rubygems requires a full build environment to build compass. (See http://compass-style.org/install/)

You can get all that with a .ddev/web-build/Dockerfile like this:

ARG BASE_IMAGE
FROM $BASE_IMAGE
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confold" --no-install-recommends --no-install-suggests build-essential ruby-full rubygems
RUN gem install compass

A slightly smaller approach would be to just add webimage_extra_packages: [ ruby-full, rubygems, build-essential ] to your .ddev/config.yaml and then use ddev exec sudo gem install compass when you need compass.

Related