Git Product home page Git Product logo

grunt-manifest-generator's Introduction

grunt-manifest-generator

this tool will scan all the html files, and get all the images, css, js, html to generator the manifest file.

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-manifest-generator

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-manifest-generator');

You can run the testcase. change you path to ./node_modeules/grunt-manifest-generator/, and run grunt. You could see the result file ./output/test.manifest file was created! The ./Gruntfile.js has the base function of this task, so you could use it as that. If you have any question, you can contact me at sina weibo: http://weibo.com/ginano

The "manifest-generator" task

Overview

In your project's Gruntfile, add a section named manifestGenerator to the data object passed into grunt.initConfig().

'use strict';

module.exports = function(grunt) {
  grunt.initConfig({
    // Configuration to be run (and then tested).
    manifestGenerator:{
      test: {
        options:{
          //is cache all the html files in source files
          //{Boolean}
          //default:true
          includeHTML:true,
          //is cache all the images tags or inline style with background-images in the  html files in source files
          //{Boolean}
          //default:true
          includeHtmlImage:true,
          //is cache all the style files imported by the html
          //{Boolean}
          //default:true
          includeCSS:true,
          //is cache all the background-images in the css contents, which were used by the  html files
          //{Boolean}
          //default:true
          includeCssImage:true,
          //is cache all the js files in the html files
          //{Boolean}
          //default:true
          includeJS:true,
          //all the files above but the fllowwing files.
          //{Array} the item could be writen as regexpress.
          //default:[]
          excludeFiles:['/\.png$/']
        },
        files: {
          //the task will scan all the source files, and generate 'test.manifest' file as the cache setting. 
          'test.manifest': ['test/test.html','test/index.html']
        }
      }
    }
  });
  // Actually load this plugin's task(s).
  grunt.loadNpmTasks('grunt-manifest-generator');
  grunt.registerTask('grunt', ['manifestGenerator:test']);
};

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

2013-8-23 0.1.0 create the plugin

2013-10-12 0.1.1 add the extraFiles option for add some extra files to the manifest file. optimize the rule of geting image files from htmlcontent.

2013-11-25 0.1.2-0.1.3 add some comments for the sourecode. change the usage of lib/util.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.