grunt-files-list2
v0.2.0
Published
Create templated list of files
Downloads
3
Readme
grunt-files-list
Create templated list of files
Getting Started
This plugin requires Grunt ~1.0.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-files-list2 --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-files-list2');
The "files_list" task
Overview
In your project's Gruntfile, add a section named files_list
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
files_list: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
})
Options
options.pathPrefix
Type: String
Default value: ``
A string value that is used to prefix the filepath.
options.pathSuffix
Type: String
Default value: ``
A string value that is used to suffix the filepath. Some get parameters for example.
Usage Examples
Default Options
In this example, the default options are used to do something with whatever. So it just output file with HTML-tags within. Tags corresponds to file extension: .js => <script>
and .css => <link>
. So, src/first.js
will be <script src="src/first.js"></script>
grunt.initConfig({
files_list: {
options: {},
files: {
'dest/filelist.html': ['src/first.js', 'src/second.js'],
},
},
})
Custom Options
In this example, custom options are used prefix and suffix the filepath. So, src/first.js
will be <script src="/js/src/first.js?version=0.1"></script>
grunt.initConfig({
files_list: {
options: {
pathPrefix: "/js/",
pathSuffix: "?verion=0.1"
},
files: {
'dest/filelist.html': ['src/first.js', 'src/second.js'],
},
},
})
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
- 2017-09-13 v0.2.0 Compatibility with Grunt 1.0.1, and rename package to grunt-file-list2
- 2014-01-22 v0.1.3 Fixed issue when several destination files are indicated
- 2013-08-20 v0.1.2 First stable version