I am using Angular 2 with angular-cli
. For customer A the CSS file style.A.css
is relevant, for customer B it's style.B.css
. Is it possible make the css files defined in apps[0].styles
dependent on the active environment? If not, any elegant solution for this?
The CSS's scope is the whole app, like a totally different appearance. So component scope will not be sufficient.
Angular applications are styled with standard CSS. That means you can apply everything you know about CSS stylesheets, selectors, rules, and media queries directly to Angular applications. Additionally, Angular can bundle component styles with components, enabling a more modular design than regular stylesheets.
A project's src/environments/ folder contains the base configuration file, environment.ts , which provides a default environment. You can add override defaults for additional environments, such as production and staging, in target-specific configuration files.
angular-cli. json is used to configure the angular 2 projects.
Where is Angular json CLI file? The angular-cli. json should be located in the root folder of the project.
We used different app-names to solve that problem. We defined different customers in our angular-cli.json and defined there which style.css to use for which app name. There we have a default and then all the customers we have and for each we can say which assets we want to use and which styles and even which enviornment is sufficient.
And to start and build the application you then only have to call 'ng serve app-name' or 'ng serve' for default
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With