Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
sass-embedded
Advanced tools
Node.js library that communicates with Embedded Dart Sass using the Embedded Sass protocol
The sass-embedded npm package provides a way to compile Sass (Syntactically Awesome Style Sheets) using the Embedded Sass protocol. This allows for faster compilation and better integration with JavaScript environments.
Compile Sass to CSS
This feature allows you to compile Sass code into CSS. The example demonstrates how to compile a simple Sass string into CSS using the `compileString` method.
const sass = require('sass-embedded');
const result = sass.compileString(`
$primary-color: #333;
body {
color: $primary-color;
}
`);
console.log(result.css);
Compile Sass from a file
This feature allows you to compile Sass from a file. The example shows how to read a Sass file, compile it, and then write the resulting CSS to an output file.
const sass = require('sass-embedded');
const fs = require('fs');
const result = sass.compile('path/to/your/file.scss');
fs.writeFileSync('path/to/output.css', result.css);
Custom Importers
This feature allows you to define custom importers to handle `@import` statements in Sass files. The example demonstrates how to create a custom importer that replaces the content of an import with a specific string.
const sass = require('sass-embedded');
const result = sass.compileString(`
@import 'custom';
body {
color: red;
}
`, {
importers: [
{
findFileUrl(url) {
if (url === 'custom') {
return new URL('data:text/plain,body { color: blue; }');
}
return null;
}
}
]
});
console.log(result.css);
node-sass is a library that provides binding for Node.js to LibSass, the C version of the popular stylesheet preprocessor, Sass. It is similar to sass-embedded in that it allows you to compile Sass to CSS, but it uses a different underlying technology (LibSass vs. Embedded Sass). node-sass is known for its speed but can be more difficult to set up due to native dependencies.
sass is the official JavaScript implementation of Sass, written in Dart and compiled to JavaScript. It is similar to sass-embedded in terms of functionality, providing a way to compile Sass to CSS. However, it does not use the Embedded Sass protocol and can be slower in some cases compared to sass-embedded.
This is a Node.js library that implements the host side of the Embedded Sass protocol. It exposes a JS API for Sass that's backed by a native Dart Sass executable. It's much faster than running Dart Sass compiled to JavaScript while still providing a full JS API, with the ability to define custom functions and importers.
Disclaimer: this is not an official Google product.
1.0.0-beta.4
Support unquoted imports in the indented syntax.
Fix a crash when :not(...)
extends a selector that appears in
:not(:not(...))
.
render()
and renderSync()
.Add compileAsync()
and compileStringAsync()
methods. These run
asynchronously, which allows them to take asynchronous importers (see below).
Add an AsyncImporter
class. This allows imports to be resolved
asynchronously in case no synchronous APIs are available. AsyncImporter
s are
only compatible with compileAysnc()
and compileStringAsync()
.
FAQs
Node.js library that communicates with Embedded Dart Sass using the Embedded Sass protocol
The npm package sass-embedded receives a total of 658,094 weekly downloads. As such, sass-embedded popularity was classified as popular.
We found that sass-embedded demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.