JSPM: importing SCSS using SystemJS in an Angular2 / TypeScript project not working

Context

I am working on a project using Angular2, TS and SystemJS. I created a simple module loader using SystemJS, which allows me to import β€œcustom” modules as follows:

import { NavComponent } from "component@nav";

Perhaps this will be important.

purpose

I would like to import files .scssinside my angular components in order to be able to do such things:

@Component({ 
    selector: 'app-view',
    styles: [ require('path/to/mainScss/file.scss') ],
    template: //...
})

Problem

I found some examples using webpack, but I cannot achieve this. During the search, I found this module . This may be interesting because it uses SystemJS like me, and I don't need to add webpack to my project.

, ( , webpack SystemJS. require undefined). jspm , npm. jspm ( ) , .

: import './styles/importer.scss!';. .

Error: SyntaxError: Unexpected token <. , , SystemJS , , .

?!

?

- ( namepace@name). modules/, / , .

, .scss , . sass angular. , , .

+4

All Articles