6

I've included a Bootstrap theme into my app. I've copied the file into src folder (the same level as styles.css) and added it as the last css in angular.json like this:

"build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/WFRH-Web",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets",
              "src/web.config"
            ],
            "styles": [
              "src/styles.css",
              "node_modules/bootstrap/dist/css/bootstrap.min.css",
              "node_modules/bootstrap-select/dist/css/bootstrap-select.min.css",
              "src/theme_minco.min.css"

and the styles are working correctly when in dev mode but they don't work after deploying my app.

The steps I use for deploying are:

1) ng build --prod
2) firebase deploy

I've also tried using an include in styles.css and only leaving styles.css in angular.json like this:

@import "theme_minco.min.css";

to no avail because it's not working either (it only works in dev).

Any help, please?

6
  • 1
    May you prepare a minimal reproducible example ? What happens if you run ng serve --prod ? Commented Sep 26, 2018 at 7:28
  • Thank you very much for your quick response @Massimo Costa. Good point, I've tried ng serve --prod and it does not work either, so the problem should be around compiling to prod but I'm not sure how to prepare you an example. Commented Sep 26, 2018 at 7:33
  • a minimal app using the CSS and use the same configuration Commented Sep 26, 2018 at 7:35
  • I guess that as it's a Bootstrap theme (they use the same classes) it could have to do with Boootstrap classes getting mixed with theme classes or theme classes being loaded before Bootstrap classes. I'm investigating this and I'll think in a way of preparing a demo. Commented Sep 26, 2018 at 7:51
  • We had a similar prob, try disabling the extractCss flag in angular.json for your prod configuration Commented Sep 26, 2018 at 8:06

1 Answer 1

16

Disable the extractCss flag in angular.json for your prod configuration

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.