gunta / grunt-manifest

Generates HTML5 Cache Manifest files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add option to add "manifest" attribute on <html> tag

gr2m opened this issue · comments

I guess the usual case is that the manifest file is supposed to be used in production only, not during the development. Is there a best practice to add the manifest attribute to the <html> tags as part of the build process?

Or maybe we should add an option for grunt-manifest directly?

Yes, you are right. Appcache manifest is not a good idea for development.

I use grunt-targethtml for filtering html files.

Marco

Am Freitag, 6. September 2013 schrieb Gregor Martynus :

I guess the usual case is that the manifest file is supposed to be used in
production only, not during the development. Is there a best practice to
add the manifest attribute to the tags as part of the build
process?

Or maybe we should add an option for grunt-manifest directly?


Reply to this email directly or view it on GitHubhttps://github.com//issues/34
.

Okay, I'd find it nice if grunt-manifest would have an option to add the manifest attribute itself, but I couldn't think of how to call the option myself. But if you're open to the idea, I'm happy to send a pull request. Just tell me your dream API for it.

What I ended up doing is using grunt-text-replace with the following configuration:

  grunt.initConfig({
    replace: {
      build: {
        src: ['dist/index.html'],
        overwrite: true,
        replacements: [{
          from: /<html([^>]+)>/,
          to: '<html$1 manifest="/manifest.appcache">'
        }]
      }
    }
  });