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 possible to configurable style compiler constants #24246

Open
Dok11 opened this issue Jun 1, 2018 · 5 comments
Open

Make possible to configurable style compiler constants #24246

Dok11 opened this issue Jun 1, 2018 · 5 comments
Labels
area: core Issues related to the framework runtime core: stylesheets feature: under consideration Feature request for which voting has completed and the request is now under consideration feature Issue that requests a new feature
Milestone

Comments

@Dok11
Copy link
Contributor

Dok11 commented Jun 1, 2018

I'm submitting a...


[x] Performance issue
[x] Feature request

Current behavior

Compiler variable and attr is constant.
https://github.com/angular/angular/blob/master/packages/compiler/src/style_compiler.ts#L16

const COMPONENT_VARIABLE = '%COMP%';
const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;

Expected behavior

Compiler variable and attr must have default values and possible to configurable.

What is the motivation / use case for changing the behavior?

Currently that constants is part of build js/css files and made files more large.
For example, statistics for my not very large project (main.bundle.ts 1 MB)

%COMP% - 1528 matches (9 168 bytes)
_nghost- - 332 matches (2 656 bytes)
_ngcontent- - 1195 matches (13 145 bytes)
Total - 24 969 excess bytes

But, maybe I konw what I do and can replace this constatns to , , (just for example).
This action will save 21 914 butes just for my example or more for bigger project with many css rules.

@vicb vicb added feature Issue that requests a new feature area: core Issues related to the framework runtime labels Jun 1, 2018
@ngbot ngbot bot added this to the Backlog milestone Jun 1, 2018
@waterplea
Copy link
Contributor

I'm polyfilling CSS variables while on server using Angular Universal and server side rendering. After we switch from server generated HTML to live app — these variables change and server side pregenerated CSS is no longer applicable. During the time browser side polyfill kicks in I see flicker in styles.

Server side generated stuff is named _nghost-sc# and front end is _nghost-c# which makes polyfill not match the elements.

@adover
Copy link

adover commented Jul 15, 2019

@waterplea can you share that polyfill? I'm looking for a similar fix using AngularElements

@waterplea
Copy link
Contributor

@adover I use https://github.com/jhildenbiddle/css-vars-ponyfill
It requires some mockups to get it to work in server environment, but overall it works pretty well with Angular. I used to have a wrapper service around it to support dynamic STYLE additions but the developer is very responsive and newer versions took everything I needed into account so its watch option now is all you really need to get it to work with Angular.

@angular-robot angular-robot bot added the feature: votes required Feature request which is currently still in the voting phase label Jun 4, 2021
@angular-robot
Copy link
Contributor

angular-robot bot commented Jun 4, 2021

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

@angular-robot angular-robot bot added the feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors label Jun 24, 2021
@angular-robot
Copy link
Contributor

angular-robot bot commented Jun 24, 2021

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

@AndrewKushnir AndrewKushnir added feature: under consideration Feature request for which voting has completed and the request is now under consideration and removed feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors feature: votes required Feature request which is currently still in the voting phase labels Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: core Issues related to the framework runtime core: stylesheets feature: under consideration Feature request for which voting has completed and the request is now under consideration feature Issue that requests a new feature
Projects
None yet
Development

No branches or pull requests

6 participants