sass / node-sass

:rainbow: Node.js bindings to libsass
https://npmjs.org/package/node-sass
MIT License
8.51k stars 1.32k forks source link

Does node-sass support @use, and @forward? #2886

Open malishahi opened 4 years ago

malishahi commented 4 years ago

I have used @use, and @forward, but it seems, they are not yet supported in LibSass?

xzyfer commented 4 years ago

No it's not supported yet

latobibor commented 4 years ago

@xzyfer May I ask if it is at least on a roadmap? As @use is the replacement for @import many people will scratch their head why their code is not compiling (I already spent 1 hour finding this closed issue).

Can we at least have a warning? Like @use and @forward are not supported by the compiler so we don't waste time double checking everything?

orionrush commented 4 years ago

@xzyfer could this issue be reopened, if only so that that this can be used as a reference in discussions of a development roadmap? As things go, 1 October 2021 will be upon us in no time.

I for one was starting to develop a small framework for vue, but now that I'm seeing that almost no-one uses the dart-sass compiler, I realise that I can't justify incorporating @use and @forward (no matter how nicely the Sass docs ask)until node-sass supports them.

What is the roadmap for the new Sass modules features?

latobibor commented 4 years ago

People who are looking for solutions (and maybe now alternatives) I can verify that the JS-based module endorsed by Sass team is supporting these features and it works with create-react-app. (The version I have tested was "sass": "^1.26.5").

orionrush commented 4 years ago

@latobibor Are you referring to the Dart Sass implementation? While it works and supports the full Sass feature set, it has a few shortcomings including:

The last point is a killer if you are working on something that you would like to have as few barriers as possible to integration and adoption.

Interesting aside, but I wonder why there are two versions of dart sass on npm: sass v 1.26.5, and dart-sass which is pegged at 1.25.

Relevant SO thread: (https://stackoverflow.com/questions/56150402/vue-cli-css-pre-processor-option-dart-sass-vs-node-sass)

latobibor commented 4 years ago

@orionrush Yes, I was referring to the Dart Sass implementation and the , which is now the officially supported implementation by the Sass team: https://sass-lang.com/dart-sass

Dart Sass is the primary implementation of Sass, which means it gets new features before any other implementation. It's fast, easy to install, and it compiles to pure JavaScript which makes it easy to integrate into modern web development workflows.

The package sass is the purely JS version, which is slower but works like a charm. @use makes sass a real language as now I can import functions and variables in a file without the fear of duplicate bundling and I also prefer local imports over globally available magic ones. That function alone worth the loss of speed.

orionrush commented 4 years ago

@latobibor that makes total sense, in the context of a project you control, for yourself or as a team decision. However, as someone interested in producing a sass toolset for wider use, forcing users to adopt the Dart Sass implementations for their project will be a deal-breaker for many. It would certainly prevent many folks from integrating into a pre-existing project that already uses node-sass.

The question is, is there an appetite/roadmap for bringing node-sass into alignment with Dart Sass with these features in mind?

okanthony commented 4 years ago

Agree with @orionrush that it'd be great to reach parity with @use

jameshelou commented 4 years ago

@xzyfer May I ask if it is at least on a roadmap? As @use is the replacement for @import many people will scratch their head why their code is not compiling (I already spent 1 hour finding this closed issue).

Can we at least have a warning? Like @use and @forward are not supported by the compiler so we don't waste time double checking everything?

I agree that in the meantime some warning or documentation of this in could save a lot of time.

stof commented 4 years ago

Well, the documentation of these features on the sass websites are showing that they are not support by libsass (which is the implementation used by node-sass)

sxqnicholas96 commented 3 years ago

Unfortunately the SASS team has decided to deprecate LibSass and will not adding support for @use. They made an announcement on their blog (https://sass-lang.com/blog/libsass-is-deprecated) and the relevant PR (https://github.com/sass/sass/issues/1094#issuecomment-716886617).