Skip to content

datenwort/grunt-files-list

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grunt-files-list

Create templated list of files

Origin

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.

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

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'],
    },
  },
})

About

Create html list of files to include in

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 92.9%
  • HTML 7.1%