Giter Site home page Giter Site logo

doginthehat / grunt2gulp.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from generalistcodes/grunt2gulp.js

0.0 2.0 0.0 207 KB

Converts Grunt task files, gruntfile.js, to Gulp files.

Home Page: http://omouse.github.io/grunt2gulp.js

License: GNU General Public License v3.0

JavaScript 100.00%

grunt2gulp.js's Introduction

grunt2gulp

Converts a Gruntfile.js to a gulp-compliant file. Why? Because if you're going to create a new tool to replace an old one, why not automate the process of porting configuration files over.

In the future, a standard for building JavaScript files should emerge and be usable by whatever build tools exist. Maybe something like GNU Make? Ah, but that's a mere fantasy...

Usage

Print out a gulp file to standard output:

grunt2gulp.js Gruntfile.js

Save the generated gulp file:

grunt2gulp.js Gruntfile.js > gulpfile.js

Drawbacks, Caveats

This is a very very rough tool, you will need to go over the generated gulp file to ensure that it works and is correct.

To see the difference, run the examples/simple-gruntfile.js through grunt2gulp and compare it to examples/simple-gulpfile.js. It got 90% of the way to a complete conversion though and it took only a bit of tweaking to get it to that state.

If there are duplicate tasks, a warning is added to the code.

How does it work?

It loads up the Gruntfile and emulates Grunt's API. When it's done looping through all the tasks in the grunt config, it shoves them into definitions or tasks. Definitions are non-objects, like strings, which need to be declared as variables when using Gulp. Tasks are converted into Gulp tasks but some special cases have to be handled, such as Karma and Watch.

Hacking on grunt2gulp

The code is dirty because Grunt is very permissive in its input. You can specify files in multiple ways: as a string, as a list of strings, or within a files property as a string or list. If Grunt were more modular it would be possible to just rip out the parser that Grunt uses to turn a config into a set of tasks without also importing the task running capability and all the other stuff.

The core functions you will want to check out are processGruntTask and processGruntConfig.

How to Report Issues

When reporting an issue with grunt2gulp.js, please try to include the Gruntfile that you were trying to convert and the error message that you received.

You can report issues here: https://github.com/omouse/grunt2gulp.js/issues

Documentation

You can generate the documentation using jsdoc:

jsdoc node_modules/grunt2gulp/bin/grunt2gulp.js

License

Licensed under the GPL.

Copyright (C) 2014-2015 Rudolf Olah [email protected]

See LICENSE for full text of license.

grunt2gulp.js's People

Contributors

rhalff avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.