Broccoli Sass to SCSS

raw JSON →
0.1.3 verified Fri May 01 auth: no javascript deprecated

A Broccoli plugin that compiles Sass/SCSS files into CSS using libsass. The current version (0.1.3) is stable but relies on an outdated Node.js addon build process (node-gyp) and libsass, which is deprecated in favor of Dart Sass. Key differentiators: integrates with the Broccoli asset pipeline, supporting multiple input trees and source maps. However, due to libsass deprecation and potential native module issues, it is recommended to use alternative plugins like 'broccoli-sass' or 'broccoli-sass-source-maps' that leverage Dart Sass or newer bindings.

error Error: Cannot find module 'broccoli-sass2scss'
cause Incorrect package name; 'broccoli-sass2scss' is not published.
fix
npm install --save-dev broccoli-sass
error Error: Module build failed: Error: Cannot find module 'node-sass'
cause Missing libsass binding; this plugin depends on node-sass which may not be installed.
fix
npm install --save-dev node-sass
error Error: The libsass native extension is not available. Try reinstalling node-sass.
cause node-gyp failed to compile native module.
fix
Reinstall build tools: npm install -g node-gyp then npm rebuild node-sass
deprecated libsass is deprecated; Dart Sass is the recommended alternative.
fix Switch to a broccoli plugin that uses Dart Sass, e.g., 'broccoli-sass-source-maps' or use sass package directly.
gotcha Package name mismatch: 'broccoli-sass2scss' does not exist; the correct package is 'broccoli-sass'.
fix Install 'broccoli-sass' instead of 'broccoli-sass2scss'.
gotcha Requires node-gyp to compile native libsass bindings; may fail on some systems.
fix Ensure build tools are installed (python, C++ compiler) or switch to a pure-JS alternative.
npm install broccoli-sass2scss
yarn add broccoli-sass2scss
pnpm add broccoli-sass2scss

Basic usage of broccoli-sass: compiles app/styles/app.scss to app.css with compact output style.

const compileSass = require('broccoli-sass');
const { WatchedDir } = require('broccoli-source');

const sourceTrees = [new WatchedDir('app/styles')];
const inputFile = 'app.scss';
const outputFile = 'app.css';
const options = { outputStyle: 'compact' };

const outputTree = compileSass(sourceTrees, inputFile, outputFile, options);

module.exports = outputTree;