
Research
/Security News
npm Author Qix Compromised via Phishing Email in Major Supply Chain Attack
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
compile-sass
Advanced tools
A module to compile SASS on-the-fly and/or save it to CSS files using node-sass
The goal of this project is twofold:
NODE_ENV=development in order to reduce development time (on-the-fly)Important Note:
This is the documentation for v2. If you need the documentation for v1, please see the Readme from the last release of v1: https://github.com/eiskalteschatten/compile-sass/tree/v1.1.3
This module is tested with Node.js >= 14. It might work with Node.js <= 13, but is not tested.
Peer Dependencies:
npm install --save compile-sass sass express
The following are a couple of examples of how you can use it in a real-life application:
Note: These examples still use v1. This notice will be removed once they have been updated.
import compileSass from 'compile-sass';
app.use('/css/:cssName', compileSass());
Pay attention to the compileSass.setup which differs from the TypeScript variation!
const compileSass = require('compile-sass');
app.use('/css/:cssName', compileSass.setup());
import compileSass from 'compile-sass';
app.use('/css/:cssName', compileSass({
sassFilePath: path.join(__dirname, 'public/scss/'),
sassFileExt: 'sass',
embedSrcMapInProd: true,
resolveTildes: true,
sassOptions: {
alertAscii: true,
verbose: true
}
}));
Pay attention to the compileSass.setup which differs from the TypeScript variation!
const compileSass = require('compile-sass');
app.use('/css/:cssName', compileSass.setup({
sassFilePath: path.join(__dirname, 'public/scss/'),
sassFileExt: 'sass',
embedSrcMapInProd: true,
resolveTildes: true,
sassOptions: {
alertAscii: true,
verbose: true
}
}));
import { compileSassAndSaveMultiple } from 'compile-sass'; // TypeScript
const { compileSassAndSaveMultiple } = require('compile-sass'); // CommonJS
await compileSassAndSaveMultiple({
sassPath: path.join(__dirname, 'public/scss/'),
cssPath: path.join(__dirname, 'public/css/'),
files: ['libs.scss']
});
}));
Returns the compiled SASS as a string.
import { compileSass } from 'compile-sass'; // TypeScript
const { compileSass } = require('compile-sass'); // CommonJS
const cssString = await compileSass();
Compiles the given SASS file and saves it in the given directory.
import { compileSassAndSave } from 'compile-sass'; // TypeScript
const { compileSassAndSave } = require('compile-sass'); // CommonJS
await compileSassAndSave('full/path/to/sass-file.scss', 'full/path/to/css/');
Compiles multiple SASS files defined in the "files" option. They must all be located in the directory defined in the "sassPath" option. The CSS files will be saved in the directory defined in the "cssPath" option.
import { compileSassAndSaveMultiple } from 'compile-sass'; // TypeScript
const { compileSassAndSaveMultiple } = require('compile-sass'); // CommonJS
await compileSassAndSaveMultiple({
sassPath: path.join(__dirname, 'public/scss/'),
cssPath: path.join(__dirname, 'public/css/'),
files: ['libs.scss']
});
});
Deletes the passed directory when the app is exited. The idea is to pass the directory where your compiled CSS files are, so that they can be deleted when the app is exited and recompiled when the app starts.
import { setupCleanupOnExit } from 'compile-sass'; // TypeScript
const { setupCleanupOnExit } = require('compile-sass'); // CommonJS
process.on('SIGINT', () => {
try {
setupCleanupOnExit('full/path/to/css');
process.exit(0);
}
catch(error) {
process.exit(1);
}
});
The update to v2 includes a couple of breaking changes to be aware of:
express and sass are now peer dependencies that need to be installed seperately. compile-sass will not work without them.nodeSassOptions parameter in the setup is now called sassOptions because the new sass compiler uses a different set of options than its predecessor. See https://sass-lang.com/documentation/js-api/interfaces/Options for the options supported by the new compiler.compile-sass now requires Node >= 14node-sass package in lieu of the Dart-based sass package
nodeSassOptions is now sassOptions with different parameters. Check the documentation above.sass package is now a peer dependency and needs to be managed by the installing projectexpress as a direct dependency since it's a peer dependency and should be managed by the installing projectbootstrap to improve testing by compiling real world examples@import that start with ~node-sassThis modules is maintained by Alex Seifert (Website, Github).
FAQs
A module to compile SASS on-the-fly and/or save it to CSS files
The npm package compile-sass receives a total of 246 weekly downloads. As such, compile-sass popularity was classified as not popular.
We found that compile-sass demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.

Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.

Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.