Skip to content
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

Allow usage of sass-embedded instead of sass package #6734

Open
4 tasks done
TomTomB opened this issue Feb 2, 2022 · 9 comments
Open
4 tasks done

Allow usage of sass-embedded instead of sass package #6734

TomTomB opened this issue Feb 2, 2022 · 9 comments
Labels
enhancement New feature or request feat: css performance Performance related enhancement

Comments

@TomTomB
Copy link

TomTomB commented Feb 2, 2022

Clear and concise description of the problem

Now that sass-embedded hit stable it would be nice to have it as an option for compiling sass/scss since it's a lot faster. Currently if you try to use it as a replacement for the sass package, you'll get the following error:

[vite] Internal server error: Preprocessor dependency "sass" not found. Did you install it?

Suggested solution

Add support for the sass-embedded package to be used instead of sass.

Alternative

No response

Additional context

No response

Validations

@pbowyer
Copy link

pbowyer commented Feb 3, 2022

I tried aliasing the package:

npm i -D sass@npm:sass-embedded@latest

which resulted in errors:

vite v2.7.13 building for production...
✓ 36 modules transformed.
[vite:css] TypeError: Cannot read property 'url' of undefined
   ╷
14 │ @import '~material-design-icons-iconfont/src/material-design-icons';
   │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
  assets\css\admin.scss 14:9  root stylesheet
file: D:/projects/example/assets/css/admin.scss
Error: TypeError: Cannot read property 'url' of undefined
   ╷
14 │ @import '~material-design-icons-iconfont/src/material-design-icons';
   │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
  assets\css\admin.scss 14:9  root stylesheet
error during build:
Error: Error: TypeError: Cannot read property 'url' of undefined
   ╷
14 │ @import '~material-design-icons-iconfont/src/material-design-icons';
   │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ╵
  assets\css\admin.scss 14:9  root stylesheet
    at handleCompileResponse (D:\projects\example\node_modules\sass\dist\lib\src\compile.js:213:15)
    at compileRequestAsync (D:\projects\example\node_modules\sass\dist\lib\src\compile.js:101:16)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

@danieka
Copy link

danieka commented Feb 10, 2022

@pbowyer @nex3 Webpack sass-loader seems to encounter the exact same error here: webpack-contrib/sass-loader#1012 (comment)

@ygj6
Copy link
Member

ygj6 commented Mar 4, 2022

FYI, I made a simple attempt to support SASS modern API #7170

@Lucide
Copy link

Lucide commented Mar 15, 2022

I'm having severe performance issues with sass (js) and carbon-components.
Being able to choose the compiler implementation, like with common Svelte, Rollup pre-processing plugins would help a lot.

@cawa-93
Copy link
Contributor

cawa-93 commented May 20, 2022

npm i -D sass@npm:sass-embedded@latest

Actually works for me. One you may need configure paths

- @import "node_modules/bootstrap/scss/variables";
+ @import "../../node_modules/bootstrap/scss/variables";

@sapphi-red
Copy link
Member

FYI there is a case when sass-embedded is slower than sass.
These are the reasons: sass/sass#3296, sass/embedded-host-node#140 (comment).

@patak-dev patak-dev added the performance Performance related enhancement label Mar 10, 2023
@bluwy
Copy link
Member

bluwy commented Apr 1, 2023

We've discussed this in the last meeting, where the slower speed of sass-embedded in some cases makes it tricky for us to have builtin support for now. Until that's fix, we could probably revisit this again.

For now, you can use npm i -D sass@npm:sass-embedded@latest as recommended above to try it.

@segevfiner
Copy link
Contributor

Maybe with this it will actually be faster instead: https://github.com/sass/dart-sass/blob/main/CHANGELOG.md#1700

@nex3
Copy link

nex3 commented Feb 6, 2024

With the new compiler classes, Embedded Sass should be pretty much universally faster than the sass package if you're using it right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feat: css performance Performance related enhancement
Projects
None yet
Development

No branches or pull requests