-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Angular 12 : Loading svg using url(../../assets/images/app_logo.svg) is not working in Scss #20882
Comments
In my case changes made to inline styles (component.ts file) are not getting updated and I guess this is also related to that. Thanks @alan-agius4 for the fix, hope next version gets published soon. |
I doubt it is. Can you please file a new issue? Thanks |
I'm seeing the same problem as the original report except I get 404 errors also on initial compilation of ng serve -- no recompile required. Then, like the original report says, if I make any change and let it recompile, it fixes just that one component. All others are still broken. |
Now that I look closely, I'm seeing the initial compilation and then immediately a second one without any changes. That might be caused by issue #20891.
|
With this change we re-emit assets referenced in component stylesheets which where uneffected by the change that re-triggered a re-compilation. Since we cache the the result of processed component CSS, during a re-compilation `postcss-cli-resources` plugin will not run which causes assets to be to emit. With this change we now cache the asset and re-emit them on every change. Closes #20882
With this change we re-emit assets referenced in component stylesheets which where uneffected by the change that re-triggered a re-compilation. Since we cache the the result of processed component CSS, during a re-compilation `postcss-cli-resources` plugin will not run which causes assets to be to emit. With this change we now cache the asset and re-emit them on every change. Closes #20882 (cherry picked from commit 5855374)
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. |
With this change we re-emit assets referenced in component stylesheets which where uneffected by the change that re-triggered a re-compilation. Since we cache the the result of processed component CSS, during a re-compilation `postcss-cli-resources` plugin will not run which causes assets to be to emit. With this change we now cache the asset and re-emit them on every change. Closes angular#20882
🐞 Bug report
Command (mark with an
x
)Is this a regression?
Yes, the previous version in which this bug was not present was: Angular 10Description
Recently I have created a new application using angular 12 in which I am getting the following bug,
I am using SVG image as
background: url('../../assets/images/app_logo.svg') no-repeat;
inauth.component.scss
file, When I do any changes in this file it renders it in the first load properly but when I do any changes in other files, it is not able to get the image and givesGET http://localhost:4200/app_logo.svg 404 (Not Found)
.During this time I am getting the following error in the console
Previously it was working in angular 10.
I have checked these #18115, #18013, #18041 and #18043 related issues but not found any proper solution.
🔬 Minimal Reproduction
In
AppComponent
template add one div and load any svg file fromassets
in that div as backgroundServe your application, when you save changes in
app.component.scss
it will render the image properly. Now update anything in any other file let's take inapp.component.html
, Now when an application is reloaded it will not show the logo SVG image.🔥 Exception or Error
🌍 Your Environment
Anything else relevant?
The text was updated successfully, but these errors were encountered: