joaogarin / angular-electron

Angular2 and Electron starter using webpack
149 stars 53 forks source link

How can I add global scss ? #70

Closed wenerme closed 7 years ago

wenerme commented 7 years ago

I found https://github.com/angular/angular-cli/issues/1253 , https://github.com/angular/angular-cli/issues/3700 , but do not works in angular-electron, how can I use common scss in angular-electron ?

wenerme commented 7 years ago

I found this https://github.com/webpack-contrib/sass-loader/issues/218#issuecomment-287535193 works for me, I use src/app/styles, but I have to mark styles as resource root to tell intellij where to resolove the import.

joaogarin commented 7 years ago

Hello,

This is not really relevant to electron itself. There are a couple of different ways to do that, the most common is to just add these styles to the root component and mark View Encapsulation to "none".

Best regards Joao Garin

joaogarin commented 7 years ago

https://angular.io/docs/ts/latest/guide/component-styles.html#!#view-encapsulation

wenerme commented 7 years ago

@joaogarin Is it possible to run by ng serve if I don't need electron's feature, it's easier for dev, I add a angular-cli, so I can use ng generate now, but not ng serve

wenerme commented 7 years ago

The default is ViewEncapsulation.None for app-component, but scss variables must used by @import, so, the issues is not solved.

joaogarin commented 7 years ago

Hello,

Sorry but I don't follow what the issue is. I am not really familiar with the CLI so don't know how its done there. This project does not use the CLI.

But here its just a scss file imported in the app.component.ts file (root component). So you can import without any problem..You can also use multiple scss files in there if you would like.