Should bower_components be gitignored?

后端 未结 6 1676
悲哀的现实
悲哀的现实 2020-12-22 18:46

Would it be good practice to keep only the bower.json file and gitignore the whole bower_components directory?

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-22 18:46

    It is good to ignore /bower_components dir and check in only bower.json and bower-locker.bower.json file if you create lock file using bower-locker written by Shawn Lonas.

    Before bower-locker created, there was disadvantage caused by an issue of bower not having shrinkwrap capability but it can be mitigated by the above library.

    Run following commands to achieve it:

    npm install bower-locker -g
    

    or

    yarn global add bower-locker
    

    then generate lock file based on existing bower.json file by runing:

    bower-locker lock
    

    The original bower.json file will be re-named to bower-locker.bower.json

提交回复
热议问题