Sass Blog

Page 1 of 9

  • Sass color spaces & wide gamut colors

    Posted 11 September 2024 by Miriam Suzanne

    Wide gamut colors are coming to Sass!

    I should clarify. Wide gamut CSS color formats like oklch(…) and color(display-p3 …) have been available in all major browsers since May, 2023. But even before that, these new color formats were allowed in Sass. This is one of my favorite features of Sass: most new CSS just works, without any need for “official” support or updates. When Sass encounters unknown CSS, it passes that code along to the browser. Not everything needs to be pre-processed.

    Often, that’s all we need. When Cascade Layers and Container Queries rolled out in browsers, there was nothing more for Sass to do. But the new CSS color formats are a bit different. Since colors are a first-class data type in Sass, we don’t always want to pass them along as-is. We often want to manipulate and manage colors before they go to the browser.

    Already know all about color spaces? Skip ahead to the new Sass features!

    The color format trade-offThe color…

  • Node Sass is end-of-life

    Posted 24 July 2024 by Natalie Weizenbaum

    The time has finally come to retire Node Sass. This Node.js wrapper for LibSass was the first official Sass compiler available in the JavaScript ecosystem and was a huge part of Sass growing beyond the scope of the Ruby community where it originated, but it hasn’t received a new release in a year and a half and the most recent set of maintainers no longer have the bandwidth to continue updating it.

    The npm package has been marked as deprecated, and the GitHub repository has been archived to mitigate confusion about which Sass repositories are still being developed. If you’re still using Node Sass, we strongly recommend you take this opportunity to migrate to the primary implementation, Dart Sass, instead.

    The LibSass implementation that Node Sass used remains deprecated but not yet end-of-life, as its maintainer Marcel Greter continues to make occasional fixes. However, there is no longer an officially-supported way to use this implementation from Node.js.

    I want to take this opportunity to thank everyone who used Node…

  • Announcing `pkg:` Importers

    Posted 16 February 2024 by Natalie Weizenbaum

    Several months ago, we asked for feedback on a proposal for a new standard for importers that could load packages from various different package managers using the shared pkg: scheme, as well as a built-in pkg: importer that supports Node.js’s module resolution algorithm. Today, I’m excited to announce that this feature has shipped in Dart Sass 1.71.0!

    No longer will you have to manually add node_modules to your loadPaths option and worry about whether nested packages will work at all. No longer will you need to add ~s to your URLs and give up all portability. Now you can just pass importers: [new NodePackageImporter()] and write @use 'pkg:library' and it’ll work just how you want out of the box.

    What is a pkg: importer?What is a pkg: importer? permalink

    Think of a pkg: importer like a specification that anyone can implement by writing a custom importer that follows a few rules. We’ve implemented one for the Node.js module algorithm, but you could implement one that loads Sass…

  • Request for Comments: Package Importer

    Posted 26 September 2023 by James Stuckey Weber

    Sass users often need to use styles from a dependency to customize an existing theme or access styling utilities. Historically, Sass has not specified a standard method for using packages from dependencies. This has led to a variety of domain-specific solutions, including the ~ prefix in Webpack, and adding node_modules to loadPaths.

    This has been a common pain point, and can make it difficult to rely on dependencies. It can also make it more difficult to move your project to a new build process.

    Package ImportersPackage Importers permalink

    We are proposing a new type of importer that allows users to use the pkg: URL scheme to direct Sass to resolve the dependency URL using the resolution standards and conventions for a specific environment.

    To address the largest use case, we are proposing a built-in Package Importer for the Node ecosystem. Our recommendation is for package authors to define a sass conditional export for entry points to their package in their distributed package.json. For example, a package.json containing:…

  • Sass in the Browser

    Posted 7 July 2023 by Natalie Weizenbaum

    Over Sass’s lifetime, we’ve seen many of the features we’ve pioneered adopted in the browser. CSS variables, math functions, and most recently nesting were all inspired by Sass. But running Sass itself as a compiler in the browser was never possible… until now.

    With the release of Dart Sass 1.63, we’re officially adding support to the sass npm package for running directly in the browser. No longer do creators of playgrounds or web IDEs need to make server calls to compile their Sass. Now you can just load it up and use it right on your very page.

    You can try it right now, in fact! Just open up your developer console and run this:

    const sass = await import('https://jspm.dev/sass');
    sass.compileString('a {color: #663399}');

    How Else Can I Use It?How Else Can I Use It? permalink

    We’ve done our best to make sure that Sass in the browser is usable as many ways as possible. It can be…

Next page