grunt-wrap

A Grunt plugin for wrapping project text files

npm install grunt-wrap
28 downloads in the last day
289 downloads in the last week
1 660 downloads in the last month

grunt-wrap

Wraps text files

Getting Started

Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-wrap

Then add this line to your project's grunt.js gruntfile:

grunt.loadNpmTasks('grunt-wrap');

Documentation

Configure which files to be copied in your initConfig:

grunt.initConfig({

  // ... other configs

  // wrap my modules with define
  wrap: {
    basic: {
      src: ['assets/*.js'],
      dest: 'dist/',
      options: {
        wrapper: ['define(function (require, exports, module) {\n', '\n});']
      }
    },
    advanced: {
      cwd: 'files/'
      expand: true,
      src: ['**/*.js', '**/*.css'],
      dest: 'dist/',
      options: {
        seperator: '\n',
        indent: '\t',
        wrapper: function(filepath, options) {
          return ['// ' + filepath, ''];
        },
        rename: function(dest, src) {
           return path.join(dest, src.replace(/(\.[\w]+)$/g, '.tagged$1'));
        }
      }
    }
  },

  // ... other configs
});

Grunt 0.3.x support

v0.1.0 is the last version to support grunt 0.3.x. This version is frozen and available here

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

  • 2013 Apr 30 - v0.3.0 - Rewrite with grunt file/option convention, unit test (Bartvds), grunt version to 0.4.1
  • 2013 Jan 31 - v0.2.0 - Implements grunt 0.4 compatibility measures, breaking support for grunt 0.3.x
  • 2012 Oct 4 - v0.1.0 - Initial release.

License

Copyright (c) 2013 Christopher Rogers Licensed under the MIT license.

npm loves you