Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    grunt-combine-harvesterpublic

    grunt-combine-harvester

    Build Status

    Scans through source code for "@requires" statements and produces a combined file which satisfies the dependencies

    You may find this library useful for building custom versions of projects like OpenLayers for use in your own grunt project.

    Getting Started

    This plugin requires Grunt ~0.4.1

    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-combine-harvester --save-dev

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

    grunt.loadNpmTasks('grunt-combine-harvester');

    The "combine_harvester" task

    Overview

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

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

    Options

    options.regex

    Type: Regex Default value: /@requires?:?\s+(\S*)\s*/g

    The regex to be used by the default harvester function to find dependencies in scanned files

    options.root

    Type: String Default value: ``

    A string value that is used to prefix the values of @requires statements, so that the resultant string can be used to locate the dependency relative to the cwd.

    This must end in '/' if you want to use a directory as a root

    options.harvester

    Type: function Default value: default_harvester

    The function which performs the harvesting of source code, to return a list of fully qualified dependencies to harvest.

    Usage Examples

    Default Options

    In this example, a root is specified. So if the dependency1 file has the content @requires dependency3, the generated result would be the concatenation: dependency3 + dependency1 + dependency2

    grunt.initConfig({
      combine_harvester: {
        options: {
          root: 'src/'
        },
        files: {
          'dest/default_options': ['src/dependency1', 'src/dependency2'],
        },
      },
    })

    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

    (Nothing yet)

    Keywords

    none

    install

    npm i grunt-combine-harvester

    Downloadsweekly downloads

    4

    version

    0.1.0

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar