Adding External / Global Styles e.g. Bootstrap
See original GitHub issueHi, Stackblitz is awesome! I’m excited to start trying it out and look forward to seeing it progress.
I have a question regarding adding styles. I normally use Sass in my Angular projects, and often pull in Bootstrap and other libraries via an @import in my style.scss file (in the top level of the src dir). This way I can also import modular styles.
// style.scss
@import "~bootstrap/dist/css/bootstrap.min.css";
@import "~font-awesome/css/font-awesome.css";
@import url('~https://fonts.googleapis.com/icon?family=Roboto');
@import "./sass/_variables.scss";
@import "./sass/_buttons.scss";
@import "./sass/_forms.scss";
I define the global stylesheet in the angular-cli.json e.g.:
// angular-cli.json
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.scss"
],
"scripts": [],
Since we don’t have access to Angular CLI on Stackblitz, what is the best way to add in a library e.g. Bootstrap and apply the styles globally?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:5 (2 by maintainers)
Top Results From Across the Web
angular-cli how to add global styles? - Stack Overflow
Copy the global styles into src/styles.css · Use CSS imports to import external rules into styles.css · Add more global styles via the...
Read more >Angular Global CSS styles - TekTutorialsHub
There are several ways to add Global CSS styles to the Angular app. The styles can be added inline, imported in index.html or...
Read more >Introduction - Bootstrap
Bootstrap employs a handful of important global styles and settings that you'll need to be aware of when using it, all of which...
Read more >How to Edit, Customize, and Override Bootstrap CSS to Suit ...
If you want to customize your Bootstrap site, leave the source code as-is and simply add custom code in an external stylesheet.
Read more >Bootstrap 4 Basics Index Page and External Style Sheet Setup
Check out our " Bootstrap 4 Make Fast Responsive Cool Websites From Scratch" course. Check it out here: http://bit.ly/BS4full-courseBootstrap ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @jacobedawson! Thanks for the kind words 😃
Best way to do this is use the “external resources” in the dependency sidebar & link to the bootstrap css files on unpkg (https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css)
We’re looking into adding static CSS/SASS file support though, would love to hear thoughts on how you’d like to see that implemented!
@maxime1992 @jacobedawson thanks for the kind words guys! ❤️ Btw, we just shipped SASS (w/ imports from NPM) and angular-cli.json config options! You can check it out in action in the Angular starter template or my Angular Material starter template — would love hear your thoughts 😃