grunt-urllist

Grunt plugin which generates a urllist.txt file from the files contained in your project

grunt-urllist

Grunt plugin for generating urllist.txt.

Install npm package:

npm install grunt-urllist

Add this line to your project's Gruntfile.js:

grunt.loadNpmTasks('grunt-urllist');

urllist is a multitask, so you can use urllist:dist and register some other tasks than "dist":

    grunt.initConfig({
    
            urllist: {
                dist: {
                    siteRoot: 'public/',
                    pattern: '/**/*.html',
                    homepage: 'https://www.example.com'
                },
                dev: {
                    siteRoot: 'src/',
                    pattern: '/**/*.html',
                    homepage: 'https://www.example.com'
                }
            }
    
    });
  • siteRoot: String (./ by default)

    Site (public root) directory relative to your grunt.js file. This is where indexing will begin and your urllist be saved to.

  • pattern: String (/**/*.html by default)

    Pattern to match website files. Defaults to any (deep) .html files. Excludes 404.html by default and converts index.html to directory path /. See minimatch for more on pattern matching.

  • homepage: String (pulled from package.json by default)

    Site URL including protocol: e.g. https://www.example.com If the homepage field is specified in your package.json it will be used from there.

There is a build process (which involves Grunt) for this Grunt task. Basically, the process will check the code with JSHint and JSCS, and execute some tests.

Before you run the Grunt task, make sure you have install the 'coffee-script' globally (in order to get the cake command available):

npm install -g coffee-script

Check that the cake command is available:

cake

It should output you the following:

cake build                # Build tasks/ from src/
cake watch                # Watch src/ for changes

You can then launch the build process with the grunt command:

grunt

Or if you just want to test (and not check code):

grunt test

This Grunt plugin was greatly inspired by grunt-sitemap by Ray Viljoen.

This plugin for Grunt is released under the MIT License.