tactivos / grunt-htmlrefs

Replaces (or removes) references to non-optimized scripts or stylesheets on HTML files
27 stars 14 forks source link

Documentation on includes is incorrect #20

Closed jnizet closed 10 years ago

jnizet commented 10 years ago

The documentation of the includes feature is incorrect in the README. The example shows the following configuration:

grunt.initConfig({
    htmlrefs: {
      dist: {
        /** @required  - string including grunt glob variables */
        src: './static/views/**/*.html',
        /** @optional  - string directory name*/
        dest: './dist/static/views/',
        /** @optional  - references external files to be included */
        includes: {
            analytics: './ga.inc' // in this case it's google analytics (see sample below)
        },
        /** any other parameter included on the options will be passed for template evaluation */
        options: {
          buildNumber: 47878,
        }
      }
    }
  });

But the only way I found to make the include actually work is to place the includes inside the options (not sure if it's the doc or the code which is wrong):

grunt.initConfig({
    htmlrefs: {
      dist: {
        /** @required  - string including grunt glob variables */
        src: './static/views/**/*.html',
        /** @optional  - string directory name*/
        dest: './dist/static/views/',
        /** any other parameter included on the options will be passed for template evaluation */
        options: {
          /** @optional  - references external files to be included */
          includes: {
              analytics: './ga.inc' // in this case it's google analytics (see sample below)
          },
          buildNumber: 47878,
        }
      }
    }
  });

If you confirm it's a bug in the documentation, I can submit a pull request to fix it. Thanks for this really useful plugin.

johnnyhalife commented 10 years ago

yes please, submit.

On Thu, Mar 20, 2014 at 5:42 PM, JB Nizet notifications@github.com wrote:

The documentation of the includes feature is incorrect in the README. The example shows the following configuration:

grunt.initConfig({ htmlrefs: { dist: { /* @required - string including grunt glob variables _/ src: './static/views/_/.html', /* @optional - string directory name/ dest: './dist/static/views/', /* @optional - references external files to be included / includes: { analytics: './ga.inc' // in this case it's google analytics (see sample below) }, /* any other parameter included on the options will be passed for template evaluation */ options: { buildNumber: 47878, } } } });

But the only way I found to make the include actually work is to place the includes inside the options (not sure if it's the doc or the code which is wrong):

grunt.initConfig({ htmlrefs: { dist: { /* @required - string including grunt glob variables _/ src: './static/views/_/.html', /* @optional - string directory name/ dest: './dist/static/views/', /* any other parameter included on the options will be passed for template evaluation / options: { /* @optional - references external files to be included */ includes: { analytics: './ga.inc' // in this case it's google analytics (see sample below) }, buildNumber: 47878, } } } });

If you confirm it's a bug in the documentation, I can submit a pull request to fix it. Thanks for this really useful plugin.

— Reply to this email directly or view it on GitHubhttps://github.com/tactivos/grunt-htmlrefs/issues/20 .