grunt-fileindex
Write index files of directory contents
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-fileindex --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt;
The "fileindex" task
Leverage the standard grunt file selector api to select files and output lists of according to various pluggable formats. Currently supported as format
parameter:
lines
- newline seperatedjson_flat
- simple json arrayscript_src
- list ofdocument.write('<script src="{path}"></script>');
(useful to update javascript includes, like a list of tests).- callback function:
function(list, options, dest){ ... }
that returns the data to write, orundefined
to skip.
More will added later or at request.
Options
//default options:
format: 'lines'
sort: false
absolute: false
//not supported by all formats:
pretty: true
Usage Examples
grunt
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.
History
- 0.1.0 - First release
License
Copyright (c) 2013 Bart van der Schoor Licensed under the MIT license.