Search code examples
cssangularangular-clisystemjs

Prevent ng-cli to associate css with components


I'm trying to migrate an app which was using SystemJS to ng-cli environment. I don't want to change too much the structure of the app, and beside, I dont use a css file for each component, I want to keep it global.

When I run ng serve, I get the following error :

ERROR in ./src/app/components/guest-sidebar.component.ts
Module not found: Error: Can't resolve './assets/css/guest-sidebar.css' in '/project/src/app/components'

I'm pretty new on ng-cli or webpack, how do I tell ng-cli I dont want it to associate components with their css and handle it separatly ?


Solution

  • Use this flag: --inline-style (alias: -is) default value: false

    If you specify true then it will expect you to handle the styles "inline" and won't generate a separate css file.