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

Make use of sass-embedded possible #23076

Closed
aersam opened this issue May 4, 2022 · 3 comments
Closed

Make use of sass-embedded possible #23076

aersam opened this issue May 4, 2022 · 3 comments

Comments

@aersam
Copy link

aersam commented May 4, 2022

Which @angular/* package(s) are relevant/related to the feature request?

compiler

Description

Hi there
Currently angular uses the sass package for compiling sass, which is of course fine. However it's not fast to compile sass this way, it's one of the pain parts we have in larger projects where we use things like bootstrap sass

Proposed solution

Sass-embedded is still experimental but offers the same API as sass and it's way faster. I had a project where build time went down by minutes by precompiling the sass and use the generated css in angular

I propose to add a feature flag to use sass-embedded

Alternatives considered

As mentioned I can preprocess my Sass outside Angular using sass-embedded, but it's not easy (had to create a fork of tilde-sass)

@JoostK JoostK transferred this issue from angular/angular May 4, 2022
@alan-agius4 alan-agius4 added needs: investigation Requires some digging to determine if action is needed area: @angular-devkit/build-angular labels May 5, 2022
@ngbot ngbot bot modified the milestone: needsTriage May 5, 2022
@alan-agius4 alan-agius4 added the feature Issue that requests a new feature label May 16, 2022
@angular-robot angular-robot bot added the feature: votes required Feature request which is currently still in the voting phase label May 16, 2022
@alan-agius4 alan-agius4 self-assigned this Jun 14, 2022
@alan-agius4 alan-agius4 removed feature Issue that requests a new feature feature: votes required Feature request which is currently still in the voting phase labels Jun 21, 2022
@angular angular deleted a comment from angular-robot bot Jun 21, 2022
@alan-agius4
Copy link
Collaborator

Hi @aersamkull,

I did a number of benchmarks around using sass-embedded vs switching to dart-sass modern API and in the majority of cases sass-embedded didn't perform as well when used in the Angular CLI.

Application compilation duration Sass API and Compiler
60852ms dart-sass legacy sync API
50058ms sass-embedded modern API
52666ms dart-sass modern API

While sass-embedded did perform considerably better on large stylesheets such as style.scss, it performed poorly on smaller components stylesheets. The main reason for this is that sass-embedded starts and shutdowns the process for each compilation. More about this can be found in this issue.

Below are some timings using the Sass modern API:

File Duration Compiler
styles.scss 3500ms dart-sass
styles.scss 815.489ms sass-embedded
app.component.scss 156.726ms dart-sass
app.component.scss 528.922ms sass-embedded

Sass-embeed also;

The biggest gain will be obtained by switching to Sass modern API. Once sass/sass#3296 is address we can re-evaluate sass-embedded.

@alan-agius4 alan-agius4 removed the needs: investigation Requires some digging to determine if action is needed label Jul 22, 2022
@alan-agius4
Copy link
Collaborator

Closing as per above.

You can track the progress on using the modern API in #23624.

@alan-agius4 alan-agius4 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 26, 2022
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants