Create templated list of files
This package based on the origin package from https://github.com/Motorin/grunt-files-list with the addition of processing not only js/css files. Used to link fonts into the html header.
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 https://github.com/datenwort/grunt-files-list.git --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-files-list');
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.
},
},
})
Type: String
Default value: ``
A string value that is used to prefix the filepath.
Type: String
Default value: ``
A string value that is used to suffix the filepath. Some get parameters for example.
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'],
},
},
})
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'],
},
},
})