Should bower_components be gitignored?

后端 未结 6 1677
悲哀的现实
悲哀的现实 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条回答
  •  梦毁少年i
    2020-12-22 19:05

    The Yeoman generator pre-filled the .gitignore file with bower_components, but it also pre-filled with other directories I would think would be needed for a final app (like www) so I did some research.

    I discovered that www/index.html is a minified version of the app/index.html. The app directory and its contents (including bower_components) contains the source files needed for the output directory (www). You commit source directories into source-control (i.e. git) but not generated files (i.e. www). Package managers like bower and npm are meant to be used during the build/generation phase and their artifacts are not meant to be checked into source-control.

    Ultimately, the source that you check into git is the bare minimum configuration needed to build the rest of project for development or deployment purposes.

提交回复
热议问题