Search code examples
angularangular2-templateangular2-build

Importing Angular 2 css from npm?


Id like to:

npm install some-css-component

And then from the corresponding angular 2 component:

@Component({
    selector: 'some-component',
    styleUrls: [ 'some-css-component, ...' ]
})

Is there a way to configure the angular build to resolve the npm some-css-component?


Solution

  • You can use CSS imports like in global styles:

    @Component({
        selector: 'some-component',
        styles: [
            '@import "/node_modules/some-css-component/dist/css/styles.css"'
        ],
    })