Skip to content

motorin/grunt-files-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grunt-files-list

Create templated list of files

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-files-list --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');

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

(Nothing yet)

About

Create html list of files to include in

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published