0

I'm confused about the proper way to use Bower. When I install components I get a large bower_components directory that contains much more than just the files I am interested in. For example, if you install jQuery with bower you get a ton of source files.

I only want to keep the files that are absolutely needed in my project to run. Is there a general solution for getting rid of the unneeded files copied down by bower? How do I know what to get rid of? Why are these even there?

Of course, if even if I do delete them, the next time I run bower install they will all come back.

What the deal here? How are you supposed to manage this stuff?

4

2 回答 2

3

如果您使用 Grunt,您可以查看grunt -preen和grunt-wiredep。第一个将清理您的 bower_components 文件夹,第二个将这些“重要”文件从已安装的软件包直接连接到您的 index.html。

于 2014-07-22T20:15:24.080 回答
1

这里已经发布了这个问题的几个答案。我的观点是你只使用你需要的文件,其余的保持原样。无论如何,您都没有/bower_components使用版本控制签入文件夹,因此唯一的危害是占用了一点点磁盘空间(例如:从 Bower 安装的 jQuery 总共是一个 2.2MB 的文件夹)。

编辑:我发现了一个名为grunt-bower-task的 grunt 插件,它可以让你微调你的 bower 安装。

于 2014-07-24T20:22:34.153 回答