Socket
Socket
Sign inDemoInstall

sass-embedded

Package Overview
Dependencies
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sass-embedded

Node.js library that communicates with Embedded Dart Sass using the Embedded Sass protocol


Version published
Weekly downloads
438K
increased by8.77%
Maintainers
2
Weekly downloads
 
Created

What is sass-embedded?

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.

What are sass-embedded's main functionalities?

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);

Other packages similar to sass-embedded

FAQs

Package last updated on 03 Sep 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc