JonnyBGod / angular2-webpack-advance-starter

An advanced Angular2 Webpack Starter project with support for ngrx/store, ngrx/effects, ng2-translate, angulartics2, lodash, NativeScript (*native* mobile), Electron (Mac, Windows and Linux desktop) and more.
https://jonnybgod.github.io/angular2-webpack-advance-starter/
MIT License
48 stars 12 forks source link

(electron:production): css relative paths #4

Closed JonnyBGod closed 7 years ago

JonnyBGod commented 7 years ago

Note: for support questions, please use one of these channels: Chat: AngularClass.slack or Twitter: @AngularClass

bug

In electron production env:

:host .class {
    background: url('path/to/file.jpg');
}

end up:

file:///path/to/file.jpg

Basically is being searched relative to the OS root folder.

npm run build:desktop

The files should be searched relative to the current app folder.

Ease of use and cohesion between different apps.

michaeljota commented 7 years ago

Hi!

I use the ng2-admin, with my own Electron integration.

They use variables to load images and fonts in their sass files, as this.

This may help, but I'm not sure how or where you would set it up in your current workflow.

JonnyBGod commented 7 years ago

@michaeljota you can use variables. Because of the isolated nature of css in angular components you should @import '../../../variables.scss'; at the beginning of each scss file you want to have the variables available.

michaeljota commented 7 years ago

Yeah, I mean. I can integrate this in my own workflow, but was thinking more about this as a solution to your current issue.