Sign inDemoInstall


Package Overview
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies



A Dart implementation of Sass, compiled to JS.

Version published
Install size
476 kB

Package description

What is sass?

The sass npm package is a preprocessor scripting language that is interpreted or compiled into Cascading Style Sheets (CSS). It enables developers to use variables, nested rules, mixins, functions, and more, which can help in writing CSS in a more structured and maintainable way.

What are sass's main functionalities?


Variables allow you to store values that you can reuse throughout your stylesheet.

$primary-color: #333;

body {
  color: $primary-color;


Nesting enables you to nest your CSS selectors in a way that follows the same visual hierarchy of your HTML.

nav {
  ul {
    margin: 0;
    padding: 0;
    list-style: none;

  li { display: inline-block; }

  a {
    display: block;
    padding: 6px 12px;
    text-decoration: none;

Partials and Import

Partials are Sass files named with a leading underscore. You can import these partials into other Sass files to modularize your CSS and help keep things easier to maintain.

// _reset.scss
ol {
  margin: 0;
  padding: 0;

// main.scss
@import 'reset';
body {
  font-family: sans-serif;


Mixins allow you to define styles that can be reused throughout your stylesheet.

@mixin border-radius($radius) {
  -webkit-border-radius: $radius;
     -moz-border-radius: $radius;
      -ms-border-radius: $radius;
          border-radius: $radius;

.box { @include border-radius(10px); }


Extend/Inheritance lets you share a set of CSS properties from one selector to another.

.message {
  border: 1px solid #ccc;
  padding: 10px;
  color: #333;

.success {
  @extend .message;
  border-color: green;


Sass supports standard math operators like +, -, *, /, and %.

.container {
  width: 100%;
.article {
  width: 600px / 960px * 100%;

Other packages similar to sass




  • Drop support for the reference combinator. This has been removed from the spec, and will be deprecated and eventually removed in other implementations.

  • Trust type annotations when compiling to JavaScript, which makes it substantially faster.

  • Compile to minified JavaScript, which decreases the code size substantially and makes startup a little faster.

  • Fix a crash when inspecting a string expression that ended in "\a".

  • Fix a bug where declarations and @extend were allowed outside of a style rule in certain circumstances.

  • Fix not in parentheses in @supports conditions.

  • Allow url as an identifier name.

  • Properly parse /***/ in selectors.

  • Properly parse unary operators immediately after commas.

  • Match Ruby Sass's rounding behavior for all functions.

  • Allow \ at the beginning of a selector in the indented syntax.

  • Fix a number of @extend bugs:

    • selector-extend() and selector-replace() now allow compound selector extendees.

    • Remove the universal selector * when unifying with other selectors.

    • Properly unify the result of multiple simple selectors in the same compound selector being extended.

    • Properly handle extensions being extended.

    • Properly follow the [first law of @extend][laws].

    • Fix selector specificity tracking to follow the [second law of @extend][laws].

    • Allow extensions that match selectors but fail to unify.

    • Partially-extended selectors are no longer used as parent selectors.

    • Fix an edge case where both the extender and the extended selector have invalid combinator sequences.

    • Don't crash with a "Bad state: no element" error in certain edge cases.



A Dart implementation of Sass. Sass makes CSS fun again.

Travis build status Appveyor build status

Using Dart Sass

There are a few different ways to install and run Dart Sass, depending on your environment and your needs.

From Chocolatey (Windows)

If you use the Chocolatey package manager for Windows, you can install Dart Sass by running

choco install sass -prerelease

That'll give you a sass executable on your command line that will run Dart Sass.


You can download the standalone Dart Sass archive for your operating system—containing the Dart VM and the snapshot of the Sass library—from the release page. Extract it, add the directory to your path, and the dart-sass executable is ready to run!

To add the directory to your path on Windows, open the Control Panel, then search for and select "edit environment variables". Find the variable named PATH, click Edit, add ;C:\path\to\dart-sass to the end of the value, then click OK.

On more Unix-y systems, edit your shell configuration file (usually ~/.bashrc or ~/.profile) and add at the end:

export PATH=$PATH:/path/to/dart-sass

Regardless of your OS, you'll need to restart your terminal in order for this configuration to take effect.

From npm

Dart Sass is available, compiled to JavaScript, as an npm package. You can install it globally using npm install -g dart-sass, or to your project using npm install dart-sass. This provides a dart-sass executable as well as a library:

var sass = require('dart-sass');

sass.render({file: scss_filename}, function(err, result) { /* ... */ });

// OR

var result = sass.renderSync({file: scss_filename});

The render() and renderSync() functions will eventually support the same API as node-sass's, but today they only supports the file option.

From Pub

If you're a Dart user, you can install Dart Sass globally using pub global activate sass ^1.0.0-alpha, which will provide a dart-sass executable. You can also add it to your pubspec and use it as a library:

import 'package:sass/sass.dart' as sass;

void main(List<String> args) {

See the Dart API docs for details.

From Source

Assuming you've already checked out this repository:

  1. Install Dart. If you download it manually, make sure the SDK's bin directory is on your PATH.

  2. In this repository, run pub get. This will install Dart Sass's dependencies.

  3. Run dart bin/sass.dart path/to/file.scss.

That's it!


Dart Sass is intended to eventually replace Ruby Sass as the canonical implementation of the Sass language. It has a number of advantages:

  • It's fast. The Dart VM is highly optimized, and getting faster all the time (for the latest performance numbers, see It's much faster than Ruby, and not too far away from C.

  • It's portable. The Dart VM has no external dependencies and can compile applications into standalone snapshot files, so a fully-functional Dart Sass could be distributed as only three files (the VM, the snapshot, and a wrapper script). Dart can also be compiled to JavaScript, which would make it easy to distribute Sass through npm or other JS package managers.

  • It's friendlier to contributors. Dart is substantially easier to learn than Ruby, and many Sass users in Google in particular are already familiar with it. More contributors translates to faster, more consistent development.

Behavioral Differences

There are a few intentional behavioral differences between Dart Sass and Ruby Sass. These are generally places where Ruby Sass has an undesired behavior, and it's substantially easier to implement the correct behavior than it would be to implement compatible behavior. These should all have tracking bugs against Ruby Sass to update the reference behavior.

  1. @extend only accepts simple selectors, as does the second argument of selector-extend(). See issue 1599.

  2. Subject selectors are not supported. See issue 1126.

  3. Pseudo selector arguments are parsed as <declaration-value>s rather than having a more limited custom parsing. See issue 2120.

  4. The numeric precision is set to 10. See issue 1122.

  5. The indented syntax parser is more flexible: it doesn't require consistent indentation across the whole document. See issue 2176.

  6. Colors do not support channel-by-channel arithmetic. See issue 2144.

  7. Unitless numbers aren't == to unit numbers with the same value. In addition, map keys follow the same logic as ==-equality. See issue 1496.

  8. rgba() and hsla() alpha values with percentage units are interpreted as percentages. Other units are forbidden. See issue 1525.

  9. Too many variable arguments passed to a function is an error. See issue 1408.

  10. Allow @extend to reach outside a media query if there's an identical @extend defined outside that query. This isn't tracked explicitly, because it'll be irrelevant when issue 1050 is fixed.

  11. Some selector pseudos containing placeholder selectors will be rendered where they wouldn't be in Ruby Sass. This better matches the semantics of the selectors in question, and is more efficient. See issue 2228.

  12. The old-style :property value syntax is not supported in the indented syntax. See issue 2245.

  13. The reference combinator is not supported. See issue 303.

  14. Universal selector unification is symmetrical. See issue 2247.

  15. @extend doesn't produce an error if it matches but fails to unify. See issue 2250.

  16. Dart Sass currently only supports UTF-8 documents. We'd like to support more, but Dart currently doesn't support them. See dart-lang/sdk#11744, for example.

Disclaimer: this is not an official Google product.



Last updated on 06 Jun 2017

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.


Related posts

SocketSocket SOC 2 Logo


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

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc