npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-wooha-html

v2.0.3

Published

Grunt HTML Builder - self fed dev craft with bower,grunt,require HTML build plugin.

Downloads

5

Readme

grunt-wooha-html

self fed dev craft with bower,grunt,require HTML build plugin.

this plugin is used for version control,html compress,js\css inject.

Update log

  • Version 2.0.2 add module.exports support with browserify

Getting Started

This plugin requires Grunt ~0.4.5

npm install grunt-wooha-html --save-dev

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

grunt.loadNpmTasks('grunt-wooha-html');

The "wooha_html" task

Overview

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

    grunt.initConfig({
    	wooha_html: {
	      options: {
	      
	      }
  		}
  	});

inject script or stylesheet

If you want inject some js or css file in html, You just need add a "inject" attribute on script tag of html.

	<script src="***" inject></script>
	<link rel="stylesheet" type="text/css" href="***" inject>

Options Quick Reference

| Option | Description | Default | |--------------------------------|-----------------|---------| |exportMode| is this project use 1:module.exports or 2:CMD or 3:react| 1 | |env| which environment build for | 'pro' | | build |grunt build folder| 'build' | |version|version code | '' with out version control | |main|page main js file | index.js | |beautify|beautify html file| false| |minify|html-minifier options.The minify option is useless when option beautify is true.More information seehtml-minifier| object|

Usage

CommonJS mode

  wooha_html: {
      dist: {
        cwd: './demo/',
        src: ['**/*.html', '!**/*.jst.html'],
        dest: './html/',
        options: {
          version: '<%= version %>',
          env: '<%= env %>',
          build: "<%= buildBase %>",
          src: "<%= srcBase %>",
          main: "index",
          exportMode: 2,
          minify: {
              preserveLineBreaks: true,
              minifyCSS: true,
              minifyJS: true,
              maxLineLength: 1024
          },
          beautify: false
        }
      }
  }

Browserify module.exports mode

    wooha_html: {
      dist: {
        cwd: './demo/',
        src: ['**/*.html', '!**/*.jst.html'],
        dest: './html/',
        options: {
          exportMode: 1,
          version: '<%= version %>',
          minify: {
              preserveLineBreaks: true,
              minifyCSS: true,
              minifyJS: true,
              maxLineLength: 1024
          },
          processContent: function (html) {
            /*
            * 统计代码注入
            * */
            return html;
          }
        }
      }
    }

React web mode

    wooha_html: {
      dist: {
        cwd: './demo/',
        src: ['**/*.html', '!**/*.jst.html', "!ueditor/**/*.html"],
        dest: './html/',
        options: {
          version: '<%= version %>',
          exportMode: 3,
          minify: {
              preserveLineBreaks: true,
              minifyCSS: true,
              minifyJS: true,
              maxLineLength: 1024
          },
          beautify: true,
          processContent: function (html) {
            /*
            * 统计代码注入
            * */
            return html;
          }
        }
      }
    }

Project orga

  • root
    • build -- build code folder
    • html -- built html folder
    • demo -- dev html folder
    • src
      • c -- lib folder
      • p -- page folder

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

(Nothing yet)