-
Notifications
You must be signed in to change notification settings - Fork 12k
Special comments /*! are removed from the styles.css #26432
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
Comments
Why do you want to retain these comments? I'd love to better understand the use case here. I believe we retain @clydin did we ever intentionally retain |
What happens here is that I recently changed the build process so that I ran a post build step that takes the outputted css to remove the unused one via PurgeCSS. I have a few CSS files that get combined into the final one and some of them have the /* purgecss start ignore */ and end ignore sections so that some classes are kept after the removal. Today I migrated to Angular 17 and noticed I had some css missing - I don’t want to say it’s a regression because I haven’t tested yet on v16. But it was not working on v17. Then I tried the special comment syntax /*! But it didn’t work either. Hope I gave you enough context. |
Why are you building in CSS you don't need in the first place? Why do these styles exist if you're just going to purge them? I get the impression there's a deeper styling problem you're trying to solve here. |
I have bootstrap included in my main styles.scss and the CSS I want to keep is because I’m applying custom styling to certain third party components that cannot be customized (for example recaptcha). I also have ng-select and font awesome. All my CSS is in use. The external css that is referenced in my styles.scss is mainly what I want to remove. |
…obal styles Prior to this change special CSS comments `/*! comment */` were being removed during minification when using the esbuild based builders. This caused tools that ran post build that rely on such comments such as purgeCSS and critters not to function properly. Closes: angular#26432
Hey @alan-agius4 , when do you guys expect to be able to merge this PR in? |
… comments in global styles Prior to this change special CSS comments `/*! comment */` were being removed during minification when using the application builder. This caused tools that ran post build that rely on such comments such as purgeCSS and critters not to function properly. We now provide a `removeSpecialComments` option to enable retention of these comments in global CSS files. Usage example: ```json { "projects": { "my-app": { "architect": { "build": { "builder": "@angular-devkit/build-angular:application", "configurations": { "production": { "optimization": { "styles": { "removeSpecialComments": false } } } } } } } } } ``` Closes: angular#26432
… comments in global styles Prior to this change special CSS comments `/*! comment */` were being removed during minification when using the application builder. This caused tools that ran post build that rely on such comments such as purgeCSS and critters not to function properly. We now provide a `removeSpecialComments` option to enable retention of these comments in global CSS files. Usage example: ```json { "projects": { "my-app": { "architect": { "build": { "builder": "@angular-devkit/build-angular:application", "configurations": { "production": { "optimization": { "styles": { "removeSpecialComments": false } } } } } } } } } ``` Closes: angular#26432
… comments in global styles Prior to this change special CSS comments `/*! comment */` were being removed during minification when using the application builder. This caused tools that ran post build that rely on such comments such as purgeCSS and critters not to function properly. We now provide a `removeSpecialComments` option to enable retention of these comments in global CSS files. Usage example: ```json { "projects": { "my-app": { "architect": { "build": { "builder": "@angular-devkit/build-angular:application", "configurations": { "production": { "optimization": { "styles": { "removeSpecialComments": false } } } } } } } } } ``` Closes: angular#26432
… comments in global styles Prior to this change special CSS comments `/*! comment */` were being removed during minification when using the application builder. This caused tools that ran post build that rely on such comments such as purgeCSS and critters not to function properly. We now provide a `removeSpecialComments` option to enable retention of these comments in global CSS files. Usage example: ```json { "projects": { "my-app": { "architect": { "build": { "builder": "@angular-devkit/build-angular:application", "configurations": { "production": { "optimization": { "styles": { "removeSpecialComments": false } } } } } } } } } ``` Closes: angular#26432
… comments in global styles Prior to this change special CSS comments `/*! comment */` were being removed during minification when using the application builder. This caused tools that ran post build that rely on such comments such as purgeCSS and critters not to function properly. We now provide a `removeSpecialComments` option to enable retention of these comments in global CSS files. Usage example: ```json { "projects": { "my-app": { "architect": { "build": { "builder": "@angular-devkit/build-angular:application", "configurations": { "production": { "optimization": { "styles": { "removeSpecialComments": false } } } } } } } } } ``` Closes: angular#26432
… comments in global styles Prior to this change special CSS comments `/*! comment */` were being removed during minification when using the application builder. This caused tools that ran post build that rely on such comments such as purgeCSS and critters not to function properly. We now provide a `removeSpecialComments` option to enable retention of these comments in global CSS files. Usage example: ```json { "projects": { "my-app": { "architect": { "build": { "builder": "@angular-devkit/build-angular:application", "configurations": { "production": { "optimization": { "styles": { "removeSpecialComments": false } } } } } } } } } ``` Closes: #26432
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Which @angular/* package(s) are the source of the bug?
compiler-cli
Is this a regression?
No
Description
I'm not sure if that's a regression, but having a brand new Angular 17 application created from the
ng new
command is not keeping the comments written in the styles.scss even if they are done in the "special" way of/*!
If you inspect the styles.scss you will see two sections of special comments that should be respected after build. When you perform a prod build you will see they are not.
Please provide a link to a minimal reproduction of the bug
https://github.com/CarlosTorrecillas/angular17
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
That has happened to me with a single file or multiple (css) files included in the angular.json project. I can also see that on recently migrated Angular solutions from v16 to v17 and on brand new A17 applications. I would need to test it on A16 applications to verify if that's a regression or not but what I can see, if I don't use the target browser application to compile is that when I have multiple files, I do see some comments respected, but only in one file. The rest of the files are removed.
The text was updated successfully, but these errors were encountered: