question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to specify different styling per environment

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [X] feature request

Versions.

@angular/cli: 1.0.0 node: 6.9.1 os: win32 x64

Desired functionality.

Ability to specify different styling per environment

Mention any other details that might be useful.

I’d like to have the ability to pass the styling when executing ng serve or ng build in the same way the environment parameter works (or… is it a way to do this already with angular cli?) We need this because we are building a product that will have different styling per client

Example: At the moment, the angular-cli.json takes styling like in the example below (adding the environment configuration to put more context to the desired functionality):

"styles": [
 	"styles.scss"
 ],
"environment": "environments/environment.ts",
"environmentSource": "environments/environment.ts",
"environments": {
	"development ": "environments/development/environment.ts",
	"client1": "environments/client1/environment.ts",
	"client2": "environments/client1/environment.ts"
}

I would ideally like to be able to set a different style list per environment, I’m suggesting something like this:

"styles": {
 	"development": [
 		"environments/development/styles/styles.scss"		
 	],
 	"client1": [
 		"environments/client1/styles/styles.scss"		
 	],
 	"client2": [
		"environments/client2/styles/styles.scss"
 	]
 }
"environment" : "environments/environment.ts",
"environmentSource": "environments/environment.ts",
"environments": {
	"development ": "environments/development/environment.ts",
	"client1": "environments/client1/environment.ts",
	"client2": "environments/client1/environment.ts"
}

Then I would run: for development: ng serve --environemnt:development --style:development ng build --bh /development/ --environemnt:development --style:development

for client1: ng serve --environemnt:client1 --style:client1 ng build --bh /client1/ --environemnt:client1 --style:client1

for client2: ng serve --environemnt:client2 --style:client2 ng build --bh /client2/ --environemnt:client2 --style:client2

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:20
  • Comments:25 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
skreborncommented, Jan 15, 2019

Can’t you already achieve this functionality with fileReplacements? I haven’t tried this, but it seems logical that you could simply do something like the following:

"configurations": {
  "production": {
    "fileReplacements": [
      {
        "replace": "src/environments/development/styles.scss",
        "with": "src/environments/client1/styles.scss"
      }
    ]
  }
}
1reaction
Khanjicommented, Apr 5, 2018

Does anyone have a solution similar to the suggestion of @jstoppa ? The need is pretty high here

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to load different global css styles for ... - Stack Overflow
In angular-cli.json it is "hardcoded" to "styles.css". Is there a way to load different css file - based on some property defined in...
Read more >
Style Sheets in HTML documents - W3C
To specify style information for more than one element, authors should use the STYLE element. For optimal flexibility, authors should define styles in...
Read more >
What Are 4 Working Styles? (And How To Learn Yours) - Indeed
In this article, we explain why understanding working styles is important, provide a list of the different types of working styles and explore ......
Read more >
How to Structure Styling in an Angular App – Three Steps to ...
This post will teach you how to find the ideal balance between global and component styling in an Angular app for maximum development...
Read more >
CSS: Cascading Style Sheets - MDN Web Docs
Here we look at text styling fundamentals, including setting font, boldness, italics, line and letter spacing, drop shadows, and other text ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found