Meteor 需要 Gulp 还是 Grunt? [英] Does Meteor need either Gulp or Grunt?

查看:16
本文介绍了Meteor 需要 Gulp 还是 Grunt?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我一直在阅读有关 GulpGrunt,以及他们如何缩小代码、压缩文件、将文件合并为一个、livereload 等.但是,Meteor 已经用 Isobuild.

So I've been reading about Gulp and Grunt, and how they can minify code, compress files, combine files into one, livereload etc. However, Meteor does all that already, with Isobuild.

我问的原因是有人建议将 Gulp 与 Meteor 一起使用,但我认为没有必要.我应该与 Meteor 一起运行 Gulp 的一些可能原因是什么?或者它只是多余的?

The reason I'm asking is someone suggested using Gulp with Meteor, and I don't see a need for it. What are some possible reasons why I should run Gulp alongside Meteor? Or it is simply redundant?

如果不是多余的,那么 Gulp 有哪些 Isobuild 中没有的功能?Meteor 团队是否计划将 Gulp 整合到其下一个版本中?

If it is not redundant, what features does Gulp has that is not in Isobuild? And will the Meteor team plan to incorporate Gulp into its next versions?

推荐答案

需要可能不是正确的词.无论您是否愿意,都是另一回事.

Need is probably not the right word. Whether you want it or not is a different story.

正如上面提到的评论,Meteor 包含一个非常聪明的构建系统,称为 isobuild,它可以为您构建整个应用程序.但在某些情况下,您可能希望自己的任务最好通过 grunt 或 gulp 来完成.(你可以用这些来完成的任务范围是惊人的,所以我只列出几个简单的常见例子.)

As the comments mentioned above, Meteor include a very clever build system of its own called isobuild, which builds your WHOLE application for you. But there are certainly instances where you may want your own tasks which would best be accomplished through grunt or gulp. (The range of tasks you can accomplish with these is staggering, so I'm only going to list a couple simple common examples.)

最明显的是要放入公用文件夹中的资产.但这远不是您可能希望在大型项目中自动化的详尽任务列表.

The most obvious is going to be for assets you want to put in your public folder. But this is far from an exhaustive list of tasks that you may want to automate on a larger project.

  • 不使用 libsass 编译器编译 SASS 文件(因为它不支持所有功能)
  • 压缩和优化图像、svg 文件、网站图标等
  • 创建多种尺寸/版本的图片
  • 创建精灵表
  • 以您自己的顺序/方式连接和缩小脚本
  • 与 Bower 结合管理无法通过大气等方式获得的前端包.

我的处理方法是将所有这些都放入私有文件夹中,因此流星 isobuild 构建系统可以避免它.

The way I would approach it is by putting all of this into the private folder, so its avoided by the meteor isobuild build system.

我相信这些是不认为 Gulp 或 Grunt 多余的充分理由,而且 grunt 或 gulp 可能执行的任务范围如此之多,以至于无法在此处全部列出.不用说,IsoBuild 的功能非常棒,但不会用这些任务运行器取代所有可能的东西,而且据我所知,没有计划将 Gulp 合并到 IsoBuild 中.IsoBuild 是 Meteor 的核心,gulp 和 grunt 是非常强大的自动化工具,具有数千种可能的用途.

I believe these are enough reasons to not consider Gulp or Grunt redundant, and the range of tasks possible with grunt or gulp are so varied they can't all be listed here. Needless to say IsoBuild is fantastic for what it does, but would not replace everything possible with these task runners, and to my knowledge there are no plans to incorporate Gulp into IsoBuild. IsoBuild is core to what Meteor is, gulp and grunt are very powerful automation tools with thousands of possible uses.

这是一个非常棒的 gulp 入门,上手超级简单:NodeJitsu Gulp 教程

Heres a really great starter for gulp, its super simple to get started with: NodeJitsu Gulp tutorial

所以,当然,您不需要 咕哝或咕哝,但它们肯定可以在您的流星项目中占有一席之地,它们绝对是值得掌握的工具,可以简化您的开发进程.

So, sure, you don't need grunt or gulp, but they could certainly have a productive place in your meteor project and they're definitely worthwhile tools to get to grips with to streamline your dev processes.

如果您想使用 grunt 或 gulp,这就是我处理项目结构的方式:

If you would like to use either grunt or gulp, this is how I approach structure my project:

Project-folder
    |__ webapp  // my meteor app lives here
    |__ assets  // scss / images / svgs
    |__ node_modules
    | gruntfile.js
    | .eslintrc
    | package.json

然后,我使用 webapp/public

请注意,随着 Meteor@1.3 的全面 npm 支持,这可能会改变,但我不清楚我们是否能够将其移动到项目中.

Note that with full npm support coming in Meteor@1.3 this may change, though I'm unclear about whether we'll be able to mvoe this into the project yet.

这篇关于Meteor 需要 Gulp 还是 Grunt?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆