M
M
Maxim Ivanov2017-01-07 17:51:49
Angular
Maxim Ivanov, 2017-01-07 17:51:49

Why are styles not loading for Angular2?

I'm trying to load styles, but they are not connected, very strange

import { Component, ViewEncapsulation } from '@angular/core';
declare var $:any;
console.log([`themes/${process.env.THEME}.scss`, 'app.component.scss'])

@Component({
  selector: 'my-app', // <my-app></my-app>
  templateUrl: './app.component.html',
  styleUrls: [`themes/beeline.scss`, 'app.component.scss'],
  encapsulation: ViewEncapsulation.None
})
export class AppComponent {

  constructor() {



  }
}

As a result, I still don’t understand why another sass file is not connected. Webpack
907c5554a38849fdb7b995d4b546f930.jpg
is responsible for loading the styles:
// all css required in src/app files will be merged in js files
      {test: /\.(scss|sass)$/, exclude: root('source', 'style'), loader: 'raw-loader!sass-loader!postcss-loader'},

And so, too, the loader does not load the path, just a line is inserted, an error occurs
@Component({
  selector: 'my-app', // <my-app></my-app>
  templateUrl: './app.component.html',
  styleUrls: [
    './app.component.scss', 
    '/themes/' + process.env.THEME + '.scss'
  ],
  encapsulation: ViewEncapsulation.None
})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iBird Rose, 2017-01-07
@splincodewd

`` -> ''

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question