Search code examples
cssangularjstwitter-bootstrapyeomanyo

how to make yo angular load bootstrap theme css


yo angular install bootstrap files all fine. The index.html file looks like this at the moment:

<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css(.) styles/vendor.css -->
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<!-- endbower -->
<!-- endbuild -->
<!-- build:css(.tmp) styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild -->

This doesn't include bootstrap.theme.css file.

What is the recommended way of adding this? Do I manually go in there and add it?


Solution

  • The correct way to do it is override you bower.json file to load bootstrap dependencies, and then run grunt wiredep

    The bower.json would look like this:

    {
      "name": "frontend",
      "version": "0.0.0",
      "dependencies": {
        "angular": "^1.3.0",
        "json3": "^3.3.0",
        "es5-shim": "^4.0.0",
        "bootstrap": "^3.2.0",
        "angular-cookies": "^1.3.0",
        "angular-route": "^1.3.0",
        "angular-local-storage": "~0.1.5",
        "raty": "~2.7.0",
        "kineticjs": "~5.1.0"
      },
      "devDependencies": {
        "angular-mocks": "~1.3.0",
        "angular-scenario": "~1.3.0"
      },
      "appPath": "app",
      "overrides": {
        "bootstrap": {
          "main": [
            "less/bootstrap.less",
            "dist/css/bootstrap.css",
            "dist/css/bootstrap-theme.css",
            "dist/js/bootstrap.js",
            "dist/fonts/glyphicons-halflings-regular.eot",
            "dist/fonts/glyphicons-halflings-regular.svg",
            "dist/fonts/glyphicons-halflings-regular.ttf",
            "dist/fonts/glyphicons-halflings-regular.woff"
          ]        
        }
      }
    }
    

    Source: https://github.com/yeoman/generator-angular/issues/965#issuecomment-68548259