All Projects → rudolfolah → Grunt2gulp.js

rudolfolah / Grunt2gulp.js

Licence: gpl-3.0
Converts Grunt task files, gruntfile.js, to Gulp files.

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Grunt2gulp.js

feweekly
⭐ 前端周刊,让你在前端领域跟上时代的脚步,深度和广度不断精进
Stars: ✭ 34 (-46.87%)
Mutual labels:  gulp, grunt
Phplint
Lightning fast concurrent PHP linter for Node.js, Grunt & Gulp! ⚡️
Stars: ✭ 62 (-3.12%)
Mutual labels:  gulp, grunt
Barekit
A bare minimum responsive framework
Stars: ✭ 201 (+214.06%)
Mutual labels:  gulp, grunt
jscrambler
Monorepo of Jscrambler's Javascript Client and Integrations
Stars: ✭ 118 (+84.38%)
Mutual labels:  gulp, grunt
generator-veams
Scaffold modern frontend web apps or web pages with a static site generator (Assemble or Mangony), Grunt and/or Gulp, Sass and Bower. Use modern frameworks like Bourbon, Bootstrap or Foundation and structure your JavaScript with ES Harmony support.
Stars: ✭ 45 (-29.69%)
Mutual labels:  gulp, grunt
Assemble
Community
Stars: ✭ 3,995 (+6142.19%)
Mutual labels:  gulp, grunt
actions-js-build
GitHub Actions for running Javascript build tools and committing file changes
Stars: ✭ 46 (-28.12%)
Mutual labels:  gulp, grunt
generator-sf
Yeoman generator that scaffolds out a Symfony PHP app including Browsersync, various CSS preprocessors, jspm, webpack, browserify and Service Worker
Stars: ✭ 14 (-78.12%)
Mutual labels:  gulp, grunt
docker-npm
npm, yarn, node, npx, bower, grunt, gulp, generate-md - build and dev tools.
Stars: ✭ 53 (-17.19%)
Mutual labels:  gulp, grunt
n-asset-macro
Asset macro for Latte and Nette Framework for assets cache busting.
Stars: ✭ 14 (-78.12%)
Mutual labels:  gulp, grunt
Docker Compose Nodejs Examples
Finally some real world examples on getting started with Docker Compose and Nodejs
Stars: ✭ 944 (+1375%)
Mutual labels:  gulp, grunt
Gulp Require Tasks
Splits Gulpfile into multiple individual files
Stars: ✭ 51 (-20.31%)
Mutual labels:  gulp
Vue Express Webpack Gulp
使用Vue,Express,Webpack,gulp搭建的自动化电影库项目
Stars: ✭ 42 (-34.37%)
Mutual labels:  gulp
Remark Boilerplate
A boilerplate to create presentations using remark, Gulp, Stylus and more.
Stars: ✭ 41 (-35.94%)
Mutual labels:  gulp
Poster
A beautiful canvas poster
Stars: ✭ 40 (-37.5%)
Mutual labels:  gulp
Livro Sem Apego
📚 Um site de doação de livros, sem fins lucrativos! o/
Stars: ✭ 58 (-9.37%)
Mutual labels:  gulp
Ng2 Tel Input
Stars: ✭ 50 (-21.87%)
Mutual labels:  gulp
Sbt Play Gulp
Gulp asset pipeline for Play Framework
Stars: ✭ 38 (-40.62%)
Mutual labels:  gulp
Dough
React/Redux + SASS + Gulp/Browserify/Babel skeleton codebase with demo application.
Stars: ✭ 38 (-40.62%)
Mutual labels:  gulp
Grunt Md2html
Small Grunt MultiTask to convert Markdown files to HTML, supporting Grunt >= 1.0.0
Stars: ✭ 37 (-42.19%)
Mutual labels:  grunt

grunt2gulp

Flattr This npm package npm downloads

Grunt2Gulp Logo

Codacy Badge

Download it on NPM: npm install 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...

Installation

It's strongly preferable to install grunt2gulp using the Github repo rather than from the central NPM:

npm install https://github.com/omouse/grunt2gulp.js/archive/0.0.2-cool-card.tar.gz

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.

Using Docker for Testing

Build the image:

docker build -t omouse/grunt2gulp.js .

Run a container with the Gruntfile to test:

mkdir cool
touch cool/Gruntfile.js
docker run --rm -v $(realpath .):/data/package omouse/grunt2gulp.js

This will mount the cool directory to /data/package into the container. The container will run the grunt2gulp command using Gruntfile.js as input and output gulpfile.js into the cool directory.

The --rm will delete the container after it's done running.

To use docker for testing grunt2gulp on different files you can use npm test.

This requires that Docker is installed and that you have built the image. It also requires GNU Coreutils and realpath command. On Mac OS X you can use brew install coreutils.

Adding new gruntfile examples

  1. Create a new directory in the examples/ directory
  2. Create the Gruntfile.js in that new directory
  3. Add a new line to docker-test-examples.sh

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 version 3 or later.

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

See LICENSE for full text of license.

Known Issues With Gruntfiles

The following is a list of issues that you will have to correct yourself before trying to convert a Gruntfile. These are issues that are found by the linter (lintGruntFile).

Most of these issues can be fixed simply by removing or commenting out the offending line in the Gruntfile but will typically require extra work to be done to work as a gulpfile.

time-grunt or grunt-timer

It is useful to know how long a task runs for. With Grunt you would use time-grunt or the grunt-timer package. In gulp, you can use the gulp-duration and/or the time-require packages.

grunt.loadTasks or grunt.task.loadTasks

LoadTasks will load custom-defined tasks for Grunt. You will have to convert those tasks to work with gulp. The guide on writing a plugin for gulp is a good starting point.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].