New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Implement support for built-in Sass modules #421
Comments
LGTM. Would you maintain a feature branch until the first built-in module/function can be parsed and evaluated, or would you release things (eg parser changes) as they're implemented? Is there a prioritized list of built-in modules/functions to be implemented? Or should it be driven by issues and PRs? |
Well, I would probably implement it first for functions that we already have through their global alias (because we already have the implementation). Then, I haven't prioritized the list of new functions yet, but
I already have a local branch where I started rewriting the Parser from scratch as a port of the dart-sass one (I started that when figuring out that fixing the parsing of interpolation in our existing parser was a nightmare). In that (partial) rewrite, I already handle the parsing of namespaces when producing the AST, except that I trigger an error instead of returning the namespaced AST. But that work is big (and I figured out I need to change the parsing of selectors first if I want to split the work, as selectors must be parsed after interpolation) |
Hello everyone. Do you have any news regarding possibly supporting Sass modules? I'm working on a project that makes massive use of them and I'm pondering our what our next move should be. |
My focus right now (on the part of my free time that I dedicate to this project) is on version 2.0 using the new architecture based on the dart-sass one. The new parser is done, but not the new evaluator. |
Implemented full support for modules (tracked in #55) will be a huge work. This RFC suggests an incremental process where we first support only built-in modules (the
sass:*
modules defined by the compiler) without supporting userland modules.Rationale
New Sass functions are only exposed as part of modules, without a global alias. That's totally understandable as any global function risks conflicts with future CSS functions. This means that if we don't ship built-in modules, we cannot ship these new functions.
With dart-sass shipping the first part of the migration towards
/
being a separator (see https://sass-lang.com/documentation/breaking-changes/slash-div), not being able to shipmath.div()
means it is not possible to write code compatible with scssphp without getting deprecation warnings in dart-sass (see #419).I expect it to be much simpler to support built-in modules than to have full support for modules:
This would still force to write your own code with
@import
to be compatible (but that's not deprecated in dart-sass), until full support lands.Things to implement
@use
, but triggering errors for any non-builtin modulessass:math
has a lot of them)@use
. Instead, it should only do it when the@use
is for a userland module (and for@forward
). Any unsupported test using a builtin module can still be skipped by the exclude list of course.@forward
won't be implemented in this step, as I don't see any reason to forward one of the built-in module. It will be implemented only as part of the full implementation.The text was updated successfully, but these errors were encountered: