Code Monkey home page Code Monkey logo

grunt-rigger's Introduction

grunt-rigger

Build Status

This is a grunt plugin for the buildJS tool rigger.

Rigger provides targetted include functionality (similar to sprockets) but with some additional functionality. A highlight of rigger functionality is outlined below:

  • Simple include format for including files using a special comment syntax (//= foo.js)
  • Ability to include remote resources as well as local: (http://github.com/buildjs/shims/string/trim.js)
  • Ability to intelligently transpile from coffee-script, stylus, etc to their natural web equivalents (js, css, etc).

Usage

To use grunt-rigger you will need to include it in your package.json file (I'd recommend under the devDependencies section):

{
  "name": "myproject",
  "devDependencies": {
    "coffee-script": "1.3.x",
    "grunt-rigger": "0.4.x"
  },
}

You will see in the example above, coffee-script is also included in the devDependencies section. In cases where you would like to leverage riggers ability to transpile files (e.g. .coffee => .js) you will need to include the appropriate node package in your devDependencies as these are not automatically included in rigger itself (to avoid library bloat).

Using grunt-rigger within grunt itself is very simple. Consider the following sample grunt.js file:

module.exports = function(grunt) {
    grunt.initConfig({
        rig: {
            compile: {        
                options: {
                    banner: '/* THIS BANNER USES TEMPLATE FUNCTIONALITY <%= banner_property %> */\n',
                    footer: '\n/* SOME FOOTER */'
                },
                files: {
                    'dist/simple.js': ['src/simple.js']
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-rigger');
};

That should be pretty much it, if your source file contains any rigger comments they will be parsed and executed accordingly.

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.