14

Libsass seems to be one of the most popular compilers for SCSS and http://sass-lang.com/libsass lists a wide variety of libsass wrappers for many common programming languages. For a node-app, node-sass and the corresponding loaders for webpack or gulp seem to be the most obvious choice. Installing and using node-sass however requires both github access and a python 2.7 interpreter and for reasons I don't want to discuss here, I have neither in my production environment.

  1. Is there a viable workaround for installing and using node-sass in production environments without github access and python interpreter?
  2. Are there other SCSS - compilers which can be used via webpack or gulp that don't need Github access and/or an installed python interpreter?
Oblomov
  • 8,953
  • 22
  • 60
  • 106

3 Answers3

3

Unless your app must compile Sass on-the-fly, You should probably compile your styles on the dev machine and push static CSS to your production environment.

tsi
  • 1,244
  • 12
  • 10
  • Sadly I haven't found a version of node-sass that will install in my CI/CD of choice. Compiling on the development machine and checking in the compiled CSS is how I ended up solving this. – ChrisRich Aug 17 '18 at 07:26
2

While similar to the answer provided by @tsi, I would suggest your build occurs not on a dev machine, but rather a build box.

Some options include Gitlabs CI or Bitbucket pipelines

If you do run it on a dev machine, make sure to do it within Vagrant or Docker to create consistent artifacts.

To answer your second question, no, there doesn't seem to be an alternative

Chris
  • 54,599
  • 30
  • 149
  • 186
2

There is now Dart-Sass, which is the official-ish "primary implementation of Sass". It is released for all the major OSes available via GitHub, Chocolatey, Scoop, Homebrew, etc.

For your use case, I'd use the version transpiled to JavaScript on npm. According to my test of a decent sized older Sass project (VideoJS), Dart-Sass is slightly slower to execute than node-sass, but not bad if you are doing minor changes.

A second pure-JS node-sass alternative is PostCSS, though you might not get use use all the Sass features you want.

tomByrer
  • 1,105
  • 12
  • 21