Does Meteor need either Gulp or Grunt?

前端 未结 1 1026
耶瑟儿~
耶瑟儿~ 2021-01-31 19:38

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 Iso

相关标签:
1条回答
  • 2021-01-31 20:37

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

    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.

    • Compile SASS files not using the libsass compiler (because it doesn't support all the features)
    • Compress and optimize images, svg files, favicons, etc.
    • Create multiple sizes / versions of images
    • Create Sprite Sheets
    • Concatenate and minify scripts in your own order / manner
    • Combine with Bower to manage front end packages that aren't available through atmosphere etc.

    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.

    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.

    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.

    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
    

    I then build, minify, and process my assets, with my target directories in webapp/public

    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.

    0 讨论(0)
提交回复
热议问题