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.

grunt-rigger's People

Contributors

damonoehlman avatar jamuhl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

grunt-rigger's Issues

Doesn't work on Windows / nodejs 0.8.8

grunt-rigger (and actually rigger v.0.2.14) doesn't seem to work on windows (32bit/2003) / nodejs 0.8.8.

It just produces the original file without the inclusions.

Rigger 0.3.17 works fine, but cant promptly replace v.0.2.14 that grunt-rigger is using... Perhaps you could update to the latest rigger...

rigger 0.5.9 breaks task

I've just done a fresh clone of a repo which uses grunt-rigger, and my tasks no longer work. it seems that this is caused by the version of rigger being specified as 0.5.x, so npm installs rigger 0.5.9 which must contain a breaking/incompatible change?

I've explicitly pegged the rigger version to 0.5.5 in my repo for now, which seems to have fixed it.

rename task to match npm module name

I don't know whether this is a good idea, or whether there are reasons for why it is the way it is. Basically all other grunt tasks seem to use something along the lines of:

^grunt\-(?:contrib\-)([A-Za-z]+)$

where the capturing group is then used as the task name when configuring grunt. However grunt-rigger uses rig as the task name. Every time I use grunt-rigger I forget this idiosyncrasy and spend ten minutes scratching my head. Would it be possible to switch to rename/alias the task to avoid this?

additional coffee compile parameter

I want to ignore coffee's auto closure for my scripts. I can do this by passing : -b bare parameter for coffee compilation. How can i do this in rigger.

Grunt 0.4 Release

I'm posting this issue to let you know that we will be publishing Grunt 0.4 on Monday, February 18th.

If your plugin is not already Grunt 0.4 compatible, would you please consider updating it? For an overview of what's changed, please see our migration guide.

If you'd like to develop against the final version of Grunt before Monday, please specify "grunt": "0.4.0rc8" as a devDependency in your project. After Monday's release, you'll be able to use "grunt": "~0.4.0" to actually publish your plugin. If you depend on any plugins from the grunt-contrib series, please see our list of release candidates for compatible versions. All of these will be updated to final status when Grunt 0.4 is published.

Also, in an effort to reduce duplication of effort and fragmentation in the developer community, could you review the grunt-contrib series of plugins to see if any of your functionality overlaps significantly with them? Grunt-contrib is community maintained with 40+ contributors—we'd love to discuss any additions you'd like to make.

Finally, we're working on a new task format that doesn't depend on Grunt: it's called node-task. Once this is complete, there will be one more conversion, and then we'll never ask you to upgrade your plugins to support our changes again. Until that happens, thanks for bearing with us!

If you have any questions about how to proceed, please respond here, or join us in #grunt on irc.freenode.net.

Thanks, we really appreciate your work!

Unable to find target for: require

Hi, I'm having trouble with a simple require of another file. I just want to do a //= require otherfile.coffee (is that even the correct syntax?)

However when I run grunt rig I get:

Running "rig:compile" (rig) task
>> Failed to rig file "protected/assets/js/main.js
>> Failed with error: "Error: Unable to find target for: require otherfile.coffee
>> Failed with error: "Error: Unable to find target for: require otherfile.coffee
Warning: Unable to find target for: require otherfile.coffee Use --force to continue.

Similarly if I provide the full path to otherfile.coffee it is still unable to find the file. Should I provide a relative path? If so relative to what directory?

Warning: Task "grunt-rigger" not found

I'm new to Node, may be doing something stupid. I get this warning when running grunt with this Gruntfile:

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    rig: {

    }
  });

  // Load plugins
  grunt.loadNpmTasks('grunt-rigger');

  // Default task(s).
  grunt.registerTask('default', ['grunt-rigger']);

};

Can anyone suggest what I may have done wrong?

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.