简体   繁体   English

混合咕噜声和吞咽

[英]Mixing grunt and gulp

I've been using grunt task runner in all of the angular projects I was involved in. 我一直在参与的所有角项目中使用grunt任务运行器。

Currently, I found a gulp-protractor-qa plugin for gulp that watches all my element selectors in the tests on the fly. 目前,我找到了一个gulp-protractor-qa插件,用于在飞行中观察我的所有元素选择器。 It is good at what it does, but now I have to have a separate gulpfile.js config for the another build system (I cannot find an appropriate alternative among grunt plugins). 它擅长它的功能,但现在我必须为另一个构建系统提供一个单独的gulpfile.js配置(我在grunt插件中找不到合适的替代方案)。

Is it okay to use both grunt and gulp build systems in a single project? 在单个项目中同时使用gruntgulp构建系统是否可以? What are the generally accepted actions in this case? 在这种情况下,普遍接受的行动是什么?


gulp-protractor-qa is just an example. gulp-protractor-qa就是一个例子。 I can imagine this would hit me again when I would need different suitable plugins in both build systems and would have to make a choice: try to sit on two chairs? 我可以想象当我在两个构建系统中需要不同的合适插件并且必须做出选择时,这会再次打击我:尝试坐在两把椅子上?

Like you said, if you don't have any other alternative with grunt , I think that the need of using both task runners is real until an equivalent solution is found or created. 就像你说的那样,如果你没有grunt任何其他选择,我认为在找到或创建等效的解决方案之前,需要使用两个任务运行器。

You should of course take care of the possible overrides and conflicts that comes with each task you add in gulp , and to me, never mix your watchers . 你当然应该注意你在gulp添加的每项任务所带来的可能的覆盖和冲突,对我来说,永远不要混淆你的watchers Always choose to use them in one or the other runner cause of the infinite loops. 总是选择在无限循环的一个或另一个运行器中使用它们。 Even if in this case with gulp-protractor-qa you are watching files, there is no dependent task which runs and nothing is written so you should be fine. 即使在这种情况下使用gulp-protractor-qa你正在观看文件,也没有依赖的任务运行而且没有任何内容写入所以你应该没事。

Also, since the new dependencies will mainly be the dev ones, the performance of your deployed app will be very slightly affected or not, except if you run your tests on each deploy, that may take a little longer to install them. 此外,由于新的依赖项主要是dev ,因此部署的应用程序的性能将受到轻微影响,除非您在每个部署上运行测试,安装它们可能需要更长时间。

It looks like something is going wrong with running two build systems in one frontend project. 看起来在一个前端项目中运行两个构建系统会出现问题。 You have an option to run grunt tasks from gulp ( https://www.npmjs.org/package/gulp-grunt ) or vice versa, gulp tasks from grunt ( https://www.npmjs.org/package/grunt-gulp ). 您可以选择从gulp( https://www.npmjs.org/package/gulp-grunt )运行grunt任务,反之亦然,从grunt( https://www.npmjs.org/package/grunt-)获取 gulp任务gulp )。 First way looks more efficient, because gulp is much faster than grunt. 第一种方式看起来更有效率,因为gulp比grunt快得多。 Consider moving to gulp entirely; 考虑完全转向gulp; many grunt plugins have "native" gulp counterparts. 许多grunt插件都有“原生”gulp对应物。

If moving to gulp seems like an option, but you don't like the idea of spending all that time to rewrite buil config for new tool, try to use some yeoman-genereators. 如果转向gulp似乎是一个选项,但你不喜欢花费所有时间来重写新工具的构建配置的想法,尝试使用一些yeoman-genereators。 In particular, I'd recommend use of awesome boom generator (npmjs.org/package/generator-boom). 特别是,我建议使用超棒的发电机(npmjs.org/package/generator-boom)。 It's the best generator for angular with gulp build from the box on the table today. 它是目前桌上盒子里最大的角度生成器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM