Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
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.
FAQs
Node.js library that communicates with Embedded Dart Sass using the Embedded Sass protocol
The npm package sass-embedded receives a total of 322,097 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 0 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.