I need to load an external css file in environment files. I have two environments: dev and prod. It works well in mode dev because the css file is in local, but not in mode prod.
environment.dev.ts
require("style-loader!./../assets/style.css");
environment.prod.ts
require("style-loader!http://abc/style.css");
Then i had this error:
Can't resolve 'http://abc/sprite.css'
How could i make it work with url ?
Thanks !
UPDATE
As the suggestion of Milad, i try to put a link with the dynamic href:
<link [attr.href]="getCss()" type="text/css">
function getCss(): string {
return this.mode === 'dev' ?
'assets/style.css':
'http://abc/sprite.css';
}
And i have the following error:
unsafe value used in a resource URL context