(Issue)
This section is non-normative.
In the new Sass module system as written, the implicit namespace of a @use
rule that loads a partial with an explicit leading underscore contains that
underscore. This was unintended and confusing, making the namespace look like a
private identifier and making it different than the same file's namespace
imported without the underscore.
This section is non-normative.
The underscore will be stripped from the namespace, so @use "_styles" will
have the implicit namespace styles rather than _styles.
This modifies the existing algorithm for Determining a @use Rule's
Namespace to read as follows (new text in bold):
-
If
rulehas an'as'clauseas:-
If
ashas an identifier, return it. -
Otherwise, return
null. The rule is global.
-
-
Let
pathbe therule's URL's path. -
Let
basenamebe the text after the final/inpath, or the entirepathifpathdoesn't contain/. -
Let
module-namebe the text before the first.inpath, or the entirepathifpathdoesn't contain.. -
If
module-namebegins with_, remove the leading_and setmodule-nameto the result. -
If
module-nameisn't a Sass identifier, throw an error. -
Return
module-name.
Although this is technically a breaking change, it will be made without a deprecation process for the following reasons:
-
Including a leading underscore in a loaded URL is unnecessary, and very few stylesheets do it in practice.
-
The module system is still very young and not yet super widely used, so it's even more unlikely that leading underscores are used in
@usestatements in particular. -
This is a fix for an unintended bug in the spec rather than a change to intended behavior that users were expected to rely upon.