Yeoman and Bower not adding Bootstrap CSS (AngularJS generator)

后端 未结 5 1255
半阙折子戏
半阙折子戏 2020-12-24 02:15

I am following along a codelab on the Yeoman webpage, and so far I\'ve managed to follow along (with a few major hiccups getting my development environment going, but now it

相关标签:
5条回答
  • 2020-12-24 02:42

    If you stick to a shell, you can just type:

    bower install --save bootstrap#3.3.4
    grunt serve
    

    That will ensure that Twitter Bootstrap gets downgraded to a more Bower/yo-angular friendly version and save it as a dev dependency. Grunt will then run 'wiredep' during its 'serve' task and append the bootstrap.css in your project's index.html.

    0 讨论(0)
  • 2020-12-24 02:44

    It is not ideal, but I rolled back to Bootstrap version 3.3.4 and setting up like this:

    bower install --save bootstrap#3.3.4
    
    bower_concat: {
      all: {
        dest: {
          'js': 'path/to/file/_bower.js',
          'css': 'path/to/file/_bower.css'
        }
      }
    }
    
    0 讨论(0)
  • 2020-12-24 02:47

    It didn't work for me either. I got a solution from here: https://github.com/twbs/bootstrap/issues/16663

    We fixed this issue temporary by overriding our project bower.json. For us it works fine, but we are waiting for some solution from Bootstrap.

    "overrides":{
        "bootstrap" : {
             "main": [
                "less/bootstrap.less",
                "dist/css/bootstrap.css",
                "dist/js/bootstrap.js"
              ]
        }
      }
    
    0 讨论(0)
  • 2020-12-24 03:00

    In the bower.json file, the dependency version of Bootstrap is set as:

    "bootstrap": "^3.2.0",
    

    By default, that means install the latest version higher than 3.2.0. As a result, the latest version 3.3.5 is installed and that breaks.

    So, remove the ^ sign and replace:

    "bootstrap": "^3.2.0",
    

    with:

    "bootstrap": "3.3.4",
    
    0 讨论(0)
  • 2020-12-24 03:04

    After doing the codelab I had exactly the same problem with the same result as you are getting (warnings and all). I had to just work around the issue by rolling back to Bootstrap 3.3.4.

    Just edit bower.json and change the Bootstrap line to:

        "bootstrap": "3.3.4",
    

    Then run the following and it should work:

        bower install
        grunt serve
    
    0 讨论(0)
提交回复
热议问题