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.

Guilherme Lopes
  • 4,688
  • 1
  • 19
  • 42
  • 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. – theMayer Jan 12 '19 at 20:33
  • It's not sass in particular, it's this WebPack pluging https://www.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:image` – Guilherme Lopes Jan 12 '19 at 20:51
  • OK, it sounds to me that you need to customize the webpack process. Have you seen [this article](https://codeburst.io/customizing-angular-cli-6-build-an-alternative-to-ng-eject-a48304cd3b21) – theMayer Jan 12 '19 at 20:54
  • apparently the feature I want is returning an error. It has been reported already but no fixes yet :( https://medium.com/@stepan.techs/while-adding-new-loader-in-scss-669d8edd40b7 – Guilherme Lopes Jan 12 '19 at 23:07

0 Answers0