2023-03-01 20:46:05 +01:00
|
|
|
---
|
|
|
|
title: Sass 3.5 is Released
|
|
|
|
author: Natalie Weizenbaum
|
2023-03-03 16:39:31 +01:00
|
|
|
date: 2017-07-07 15:33:00 -8
|
2023-03-01 20:46:05 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
I'm excited to announce that I've just released the stable version of Sass 3.5.
|
|
|
|
This release focuses on compatibility with new CSS syntax, and helps lay the
|
|
|
|
groundwork for the upcoming module system and compatibility with [Dart
|
|
|
|
Sass](/blog/announcing-dart-sass).
|
|
|
|
|
|
|
|
Most of the major features in 3.5 were already in the release candidate, which
|
|
|
|
[you can read about here](/blog/sass-35-release-candidate). But there are a
|
|
|
|
handful of other changes that have been added since then:
|
|
|
|
|
2023-03-09 17:19:39 +01:00
|
|
|
* Sass now supports the [the `::slotted()`
|
2023-03-01 20:46:05 +01:00
|
|
|
pseudo-element](https://drafts.csswg.org/css-scoping-1/#slotted-pseudo),
|
|
|
|
including extending its selector arguments.
|
|
|
|
|
2023-03-09 17:19:39 +01:00
|
|
|
* [The `var()` function](https://www.w3.org/TR/css-variables-1/#using-variables)
|
2023-03-01 20:46:05 +01:00
|
|
|
may be safely passed to the CSS color functions `rgb()`, `rgba()`, `hsl()`,
|
|
|
|
and `hsla()`.
|
|
|
|
|
2023-03-09 17:19:39 +01:00
|
|
|
* Transparent colors created by Sass's color functions will now be written as
|
2023-03-01 20:46:05 +01:00
|
|
|
`rgba(0, 0, 0, 0)` rather than `transparent` to work around a bug in Internet
|
|
|
|
Explorer. Colors written as `transparent` in the document will still be
|
|
|
|
emitted as written.
|
|
|
|
|
|
|
|
### Dart Sass Compatibility
|
|
|
|
|
|
|
|
[I wrote last month](http://sass.logdown.com/posts/1909151) about our plans for
|
|
|
|
keeping Ruby Sass compatible with Dart Sass in the short term. Sass 3.5 begins
|
|
|
|
to implement those plans by adding support for a number of small behavioral
|
|
|
|
extensions added by Dart Sass:
|
|
|
|
|
2023-03-09 17:19:39 +01:00
|
|
|
* It's no longer an error to `@extend` a selector that appears in the
|
2023-03-01 20:46:05 +01:00
|
|
|
stylesheet, but for which unification fails. The purpose of extension errors
|
|
|
|
was to prevent typos, which weren't occurring in this case.
|
|
|
|
|
2023-03-09 17:19:39 +01:00
|
|
|
* Pseudo selectors that take arguments can now take any argument that matches
|
2023-03-01 20:46:05 +01:00
|
|
|
CSS's [`<declataion-value>`
|
|
|
|
syntax](https://drafts.csswg.org/css-syntax-3/#typedef-declaration-value).
|
|
|
|
This will provide better forwards-compatibility with new selectors.
|
|
|
|
|
2023-03-09 17:19:39 +01:00
|
|
|
* Pseudo selectors that contain placeholder selectors as well as
|
2023-03-01 20:46:05 +01:00
|
|
|
non-placeholders—for example, `:matches(.foo, %bar)`—will no longer be
|
|
|
|
eliminated. This matches the definition of a placeholder as a selector that
|
|
|
|
matches nothing.
|
|
|
|
|
2023-03-09 17:19:39 +01:00
|
|
|
* You can now vary the indentation within an indented-syntax file, as long as it
|
2023-03-01 20:46:05 +01:00
|
|
|
still defines a consistent tree structure.
|
|
|
|
|
|
|
|
There are also some deprecations for functionality that's not supported in Ruby
|
|
|
|
Sass:
|
|
|
|
|
2023-03-09 17:19:39 +01:00
|
|
|
* Extending compound selectors, such as `@extend .foo.bar`, is deprecated. This
|
2023-03-01 20:46:05 +01:00
|
|
|
never followed the stated semantics of extend: elements that match the
|
|
|
|
extending selector are styled as though they matches the extended selector.
|
|
|
|
|
2023-03-09 17:19:39 +01:00
|
|
|
When you write `h1 {@extend .a.b}`, this *should* mean that all `h1` elements
|
2023-03-01 20:46:05 +01:00
|
|
|
are styled as though they match `.a.b`—that is, as though they have `class="a
|
2023-03-09 17:19:39 +01:00
|
|
|
b"`, which means they'd match both `.a` and `.b` separately. But instead we
|
|
|
|
extend only selectors that contain *both* `.a` and `.b`, which is incorrect.
|
2023-03-01 20:46:05 +01:00
|
|
|
|
2023-03-09 17:19:39 +01:00
|
|
|
* Color arithmetic is deprecated. Channel-by-channel arithmetic doesn't
|
2023-03-01 20:46:05 +01:00
|
|
|
correspond closely to intuitive understandings of color. Sass's suite of
|
2023-06-20 17:20:07 +02:00
|
|
|
[color functions](/documentation/modules/color/)
|
2023-03-01 20:46:05 +01:00
|
|
|
are a much cleaner and more comprehensible way of manipulating colors
|
|
|
|
dynamically.
|
|
|
|
|
2023-03-09 17:19:39 +01:00
|
|
|
* The reference combinator, `/foo/`, is deprecated since it hasn't been in the
|
2023-03-01 20:46:05 +01:00
|
|
|
CSS specification for some time and is being removed from Chrome soon.
|
|
|
|
|
2023-03-09 17:19:39 +01:00
|
|
|
* The old-style `:name value` property syntax is deprecated. This syntax is not
|
2023-03-01 20:46:05 +01:00
|
|
|
widely used, and is unnecessarily different from CSS.
|
|
|
|
|
|
|
|
### LibSass Compatibility
|
|
|
|
|
|
|
|
[LibSass](/libsass), the C++ implementation of Sass, is well on its way to
|
|
|
|
compatibility with all these features. It's not quite there yet, but we decided
|
|
|
|
we didn't want to block the 3.5 release on 100% compatibility. LibSass will
|
|
|
|
release these features as it implements them.
|
|
|
|
|
|
|
|
### What's Next?
|
|
|
|
|
|
|
|
In the most immediate future, I'm going on leave for a few months, so there's
|
|
|
|
not likely to be a huge amount of work. Once that's over, I'll be focusing on
|
|
|
|
getting Dart Sass to a full 1.0.0 release, which means spending a bunch of time
|
|
|
|
making its JavaScript API compatible with
|
|
|
|
[node-sass](http://npmjs.com/package/node-sass).
|
|
|
|
|
|
|
|
As far as Ruby Sass goes, I'll continue to fix bugs and add support for the CSS
|
|
|
|
features as browsers start to support them. Once Dart Sass 1.0.0 is out, I'll
|
|
|
|
add new features concurrently across both Ruby and Dart until the one-year
|
|
|
|
support period is up.
|
|
|
|
|
|
|
|
But for now, run `gem update sass` and enjoy 3.5!
|