Socket
Socket
Sign inDemoInstall

grunt-payload

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    grunt-payload

Make shorthand Payload module loader syntax minification-safe.


Version published
Maintainers
1
Created

Readme

Source

grunt-payload

Make shorthand Payload module loader syntax minification-safe.

Converts payload(function(dependency) { } ) to payload(['dependency'], function(dependency) { } ).

Similar to ng-annotate, but for the Payload module loader instead of Angular.

If you're using arrow functions to wrap your modules, be sure to run grunt-payload after your transpilation step and before minification.

// This needs to be transpiled before running grunt-payload
payload($ => {
  $.doSomething();
});

Getting Started

This plugin was built on Grunt ~0.4.5

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-payload --save-dev

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

grunt.loadNpmTasks('grunt-payload');

The "payload" task

Overview

In your project's Gruntfile, add a section named payload to the data object passed into grunt.initConfig().

grunt.initConfig({
  payload: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
});

Options

options.separator

Type: String Default value: '\n'

A string value that is added between concatenated files. Newline is a safe choice because it prevents your code from being added to a comment line.

Usage Examples

Default Options

Make your Payload modules minification safe and concatenate them all into one file:

grunt.initConfig({
  payload: {
    options: {},
    files: {
      'dist/minification-safe.js': ['src/app.js', 'src/folder/*.js'],
    },
  },
});
Custom Options

Make your Payload modules minification safe and write them to corresponding files in a new directory:

grunt.initConfig({
  payload: {
    options: {
      separator: ':',
    },
    files: [{
      expand: true,
      src: ['src/file.js', 'src/folder/*.js'],
      dest: 'dist',
      ext: '.js'
    }]
  },
});

Keywords

FAQs

Last updated on 21 Oct 2015

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