How to make yo angular download css boot theme

yo angularinstall boot files. The file is index.htmlas follows:

<!-- 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 does not include the file bootstrap.theme.css.

What is the recommended way to add this? Can I manually enter there and add it?

+4
source share
3 answers

The proper way to do this is to override the bower.json file to load the download dependencies, and then run grunt wiredep

bower.json will 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

+7
source

Do the following

bower install bootstrap-css --save
+3
source

.css include, (, bower_components/).

If the file is not accessible locally, I would add it right above <!-- Place favicon.ico ... -->, otherwise it might break yours grunt buildand / or grunt servebecause of bowertrying to minimize the file.

The same thing happens with the import of Google Font, put them above <!-- Place favicon.ico ... -->otherwise it bowerwill try to minimize it (in htmlminoptions in Gruntfile.js).

Here you can read a little more about the subject.

0
source

Source: https://habr.com/ru/post/1569039/


All Articles