bower installs several files. why and how can I change it?

前端 未结 3 374
你的背包
你的背包 2020-12-29 23:19

I am using bower to install dependencies for my project(I know there is yeoman but I am using bower). After setting up component.json file, when I do bower install it instal

相关标签:
3条回答
  • 2020-12-29 23:55

    It's up to the package authors to specify what files to exclude from the package using the ignore property. For now just include the files you want in the your app/website and ignore the rest.

    0 讨论(0)
  • 2020-12-30 00:09

    I recently wrote up a possible solution to this problem and will highlight the main points below.

    If you know you want a specific file from a particular package, it is easy enough to tell bower to only grab that file. For instance, with normalize.css, the only file that I care about is, well, normalize.css. So instead of typing:

    bower install --save normalize-css
    

    I can be more specific and tell bower to just download the css file:

    bower install --save https://raw.github.com/necolas/normalize.css/master/normalize.css
    

    That, of course, will always grab the latest version of normalize from the repository's master branch when bower install is invoked for your project. If, however, I want to make sure I always get the 3.0.0 version of normalize, then I can dig through the releases/history to find the appropriate URL and viola:

    bower install --save http://necolas.github.io/normalize.css/3.0.0/normalize.css
    
    0 讨论(0)
  • 2020-12-30 00:15

    You can check out bower-installer.

    bower list --path usually tells about the main js file in the package, which bower-installer conveniently picks up and exports only those files to your asset directories. You can then use this directory instead and ignore the bower_components dir.

    0 讨论(0)
提交回复
热议问题