Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Duplicate files easily with templating support via Grunt
JavaScript
branch: master
Failed to load latest commit information.
tasks feat(#1): fix issue with destinatio path
test feat: initial commit
.gitignore feat: initial commit
.jshintrc feat: initial commit
.travis.yml feat: add travis manifest file
Gruntfile.js feat(#1): fix issue with destinatio path
LICENSE feat: initial commit
README.md feat(#1): fix issue with destinatio path
package.json

README.md

grunt-duplicate

Build Status Dependency Status

Duplicate files via Grunt with templating support

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

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

grunt.loadNpmTasks('grunt-duplicate');

The "duplicate" task

Usage Examples

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

grunt.initConfig({
  duplicate: {
    options: {
      template: true,
      copies: 100,
      data: {
        custom: 'data'
      }
    },
    files: {
      'copies/': ['src/*.js', 'src/*.css'],
    }
  }
})

Example file

Generated file: <%= id %>
Total copies: <%= total %>

Options

template

Type: boolean Default value: true

Process files content and replaces values between <%= %>

copies

Type: number Default value: 1

Number of copies to do per file

data

Type: object Default value: null

Pass custom data to replace in the file

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.

License

Copyright (c) 2014 Tomas Aparicio

Released under the MIT license

Something went wrong with that request. Please try again.