How to use 'url-loader' with angular-cli compiler
Asked Answered
D

0

9

Usually I run my projects and build my SASS files with WebPack, which I have the rules in way that generates a CSS files with url-loader converting all url(...) inside that sass file to a dataURI.

so background: url('my-file.svg') would be converted to background url('data:image/svg+xml;base64,SoMeGiBbeRiShHeRe')

I'd like to know if there is a way to achieve this with the ng compiler? I researched a bit on this, and the way to do it was to use ng eject but that option is no longer available.

Deltadeltaic answered 12/1, 2019 at 20:28 Comment(4)
I'm not familiar with this function, but is this a standard Sass feature? It strikes me as odd that you would need to configure Angular to tweak anything.Sorrow
It's not sass in particular, it's this WebPack pluging npmjs.com/package/url-loader - I'd like to use it with angular-cli because I need this functionality to convert my svg icons into base64 data:imageDeltadeltaic
OK, it sounds to me that you need to customize the webpack process. Have you seen this articleSorrow
apparently the feature I want is returning an error. It has been reported already but no fixes yet :( medium.com/@stepan.techs/…Deltadeltaic

© 2022 - 2024 — McMap. All rights reserved.