Socket
Socket
Sign inDemoInstall

grunt-gulp

Package Overview
Dependencies
241
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    grunt-gulp

Run gulp tasks through grunt


Version published
Weekly downloads
606
increased by30.89%
Maintainers
1
Install size
5.81 MB
Created
Weekly downloads
 

Readme

Source

grunt-gulp Build Status

Run gulp tasks through declarative Grunt config

Getting Started

This plugin requires Grunt ~0.4.2

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-gulp --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-gulp');

Examples

A simple example that concats a list of javascript files in the lib/ folder to dist/bundle.js with gulp:

grunt.initConfig({
  gulp: {
    'dist/bundle.js': ['lib/*.js'],
  },
});

But you're probably using this task because you want to use gulp tasks. So lets extend the example to compile coffeescript using gulp-coffee:

grunt.initConfig({
  gulp: {
    options: {
      tasks: function(stream) {
        return stream.pipe(require('gulp-coffee')());
      },
    },
    'dist/bundle.js': ['lib/*.coffee'],
  },
});

This task supports all of the ways Grunt can be configured. Such as with expand: true; this example will compile each coffeescript file within the lib/ folder into the dist/ folder:

grunt.initConfig({
  gulp: {
    target: {
      options: {
        tasks: function(stream) { return stream.pipe(require('gulp-coffee')()); },
      },
      expand: true,
      cwd: 'lib/',
      src: '*.coffee',
      dest: 'dist/',
    },
  },
});

Or maybe you prefer a more gulp-like imperative config but still want to integrate with your Grunt build. You can bypass the Grunt config all together but still integrate:

var gulp = require('gulp');
var coffee = require('gulp-coffee');
var concat = require('gulp-concat');

grunt.initConfig({
  gulp: {
    myown: function() {
      var dest = gulp.dest('dist/');
      dest.on('end', function() {
        grunt.log.ok('All done!');
      });
      return gulp.src('lib/*.coffee')
        .pipe(coffee())
        .pipe(concat('bundle.js'))
        .pipe(dest);
    },
  },
});

Options

options.tasks

Type: Function
Default value: null

A function to pipe gulp tasks into your stream. Such as with gulp-coffee and gulp-uglify:

grunt.initConfig({
  gulp: {
    target: {
      options: {
        tasks: function(stream) {
          var coffee = require('gulp-coffee')({ bare: true }).on('error', grunt.log.error);
          var minify = require('gulp-uglify')();
          return stream.pipe(coffee).pipe(minify);
        },
      },
      src: ['lib/*.coffee'],
      dest: 'dist/bundle.min.js',
    },
  },
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • 1.0.1 - Fix gulp.run deprecation.
  • 1.0.0 - Update gulp dependencies and tag peerDependencies as grunt>=0.4.0
  • 0.1.0 - initial release

Keywords

FAQs

Last updated on 16 Nov 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc