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 🙏

© 2026 – Pkg Stats / Ryan Hefner

grunt-htmlojc

v0.1.2

Published

compression html's js and css script

Readme

grunt-htmlojc

优化html的js和css脚本,此工具的原理是合并html文件中的指定需要合并的文件并替换合并后的文件,新生成的文件以内容md5码进行命令,这样是为了控制浏览器加载文件的缓存,例子见example文件夹

Getting Started

This plugin requires Grunt ~0.4.5

  • 本插件需要node和grunt环境 node安装环境参考node 官网(http://nodejs.org/)
  • grunt安装环境参考grunt 官网(http://www.gruntjs.net/)
npm install grunt-htmlojc --save-dev

安装好插件之后需要在您的 Gruntfile 文件中如下方式引用插件:

grunt.loadNpmTasks('grunt-htmlojc');

The "htmlojc" task

Overview

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

grunt.initConfig({
  htmlojc: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
});

Options

options.banner

Type: String Default value: ''

优化后的文件开始注释

options.footer

Type: String Default value: ''

优化后的文件结尾注释

options.domain

Type: String Default value: ''

是上线后脚本的静态资源(CDN地址),默认为空.

options.rootPath

Type: String Default value: ''

工作目录,相对于Gruntfile.js文件,例如: project
-src
--webapp
---resource
---WEB-INFO
----...
-Gruntfile.js
此时rootPath为src/webapp

options.dest

Type: String Default value: 'statics'

优化后保存的文件目录,此目录是相对于rootPath的

Usage Examples

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<!--{{{-->
<link rel="stylesheet" type="text/css" href="css/base.css" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<!--}}}-->
</head>
<body>
这里是测试
<!--{{{-->
<script src="js/common.js" ></script>
<script src="css/index.js" ></script>
<!--}}}-->
</body>
grunt.initConfig({
  htmlojc: {
     options: {
          domain:'',
          rootPath:'example',
          dest:'statics/release'
       },
       main:{
          files: [
            {
              src:'example/**/*.html'
            }
          ]
      }
  },
});

Release History

(Nothing yet)