Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an alternative for --rebaseRootRelativeCssUrls option in Angular CLI 8?

I had a lot of issues because my application is hosted inside a subfolder and for that reason the relative /assets/ path, which is referenced inside .scss files, doesn't work. The solution was to enable the --rebaseRootRelativeCssUrls option to get the expected behaviour. With that option, the build process has adjusted my /assets/ paths by injecting the "--base-href" value and now the referenced images and fonts are loading correctly.

However, I see in the documentation that the option is deprecated and it will be removed in the next major release.

https://angular.io/cli/build (search for --rebaseRootRelativeCssUrls)

So my question is, what is the alternative, is there any other way to get the same result?

like image 397
IMujagic Avatar asked Jul 10 '19 11:07

IMujagic


People also ask

Where is Angular CLI json located?

Where is Angular json CLI file? The angular-cli. json should be located in the root folder of the project.

What is output hashing in Angular?

--output-hashing all — hash contents of the generated files and append hash to the file name to facilitate browser cache busting (any change to file content will result in different hash and hence browser is forced to load a new version of the file)

What is used Angular CLI json?

Angular CLI uses JSON Schema to enforce the configuration schema. The Angular team created Schematics packages which are used by the CLI. We can configure the options of Schematics packages, as we please, for the root project and internal projects as well.


1 Answers

According to the release notes, the recommended method for transition is using relative URLs in your .scss files. This, to me, seems like a bad idea though. Here’s a comment from the dev team on a bug logged about this issue.

https://github.com/angular/angular-cli/issues/14587#issuecomment-497368020

like image 104
Ragnaraxis Avatar answered Sep 23 '22 18:09

Ragnaraxis