Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Find files and process their paths in a template.
CoffeeScript JavaScript
tag: v0.1.2

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
tasks
test
.editorconfig
.gitattributes
.gitignore
.jshintrc
.npmignore
Gruntfile.coffee
LICENSE-MIT
README.md
package.json

README.md

grunt-pathfinder

Find files and process their paths in a template.

Getting Started

If you haven't used grunt before, be sure to check out the Getting Started guide.

From the same directory as your project's Gruntfile and package.json, install this plugin with the following command:

npm install grunt-pathfinder --save-dev

Once that's done, add this line to your project's Gruntfile:

grunt.loadNpmTasks('grunt-pathfinder');

If the plugin has been installed correctly, running grunt --help at the command line should list the newly-installed plugin's task or tasks. In addition, the plugin should be listed in package.json as a devDependency, which ensures that it will be installed whenever the npm install command is run.

The "importjs" task

Overview

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

grunt.initConfig({
  pathfinder: {
    main: {
      files:
        'path/to/output.js': ['some/**/*.js', 'other/whatever.js'],
      template: 'path/to/template.js'
    }
  }
});

Options

The pathfinder task

Overview

Inside your Gruntfile, add a section named pathfinder. This section specifies the possible files to import and the method of importing them.

Settings

There are a number of options available. Please review the minimatch options here. As well as some additional options as follows:

files

Type: object

key:value pair that describes outputFile:filesToImport. This defines where the compiled template output will be saved to (key) where dependencies are looked for (value). Value can be a string or an array of files and/or minimatch patterns.

template

Type: String

The template file will be parsed using grunt.template and the found js dependencies will be passed as data. The dependencies array is available in your template file.

Something went wrong with that request. Please try again.