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

fd-gulp-jsmin

v0.0.2

Published

minify js files.

Downloads

9

Readme

fd-gulp-jsmin任务是根据指定的书写规则来对js文件进行压缩,此插件使用的是yuicompressor-2.4.7.jar压缩工具包。

用法

jsMin(srcDir [,opt]);

例子

var gulp = require('gulp');
var jsMin = require('fd-gulp-jsmin');

gulp.task('jsMin', function() {
	gulp.src('D:/wwwroot/workspace/fd-gulp-jsconcat/test/style_test/**/*.js')
		.pipe(jsMin('D:/wwwroot/workspace/fd-gulp-jsmin/test/style_test'))
		.pipe(gulp.dest('./output'));
});

合并规则

  • 默认不对代码进行压缩
  • 开启压缩以及配置压缩的方式是在 js 的注释中写入相应的控制语句
  • 开启压缩需要写入:!!cmd:compress=true
  • (可选)把中文转成 unicode 的形式,写入: !!cmd:conv2unicode=true
  • (可选)使用 yui compressor 的 js 压缩选项: !!cmd:jsCompressOpt=["$option"] $option 为 yui compressor 支持的三种压缩模式任意之一
  • 如果只想使用 yui 的默认压缩,请不要写入 !!cmd:jsCompressOpt 这一项
  • 只有开启了压缩,js 的压缩选项,中文转 unicode 这些配置才会生效
  • 由于压缩比较耗时,所以不要对不会被页面直接引入的文件配置压缩,建议只对 merge 文件配置压缩

js 压缩选项功能 --nomunge Minify only. Do not obfuscate local symbols.

--preserve-semi Preserve unnecessary semicolons (such as right before a '}') This option is useful when compressed code has to be run through JSLint (which is the case of YUI for example)

--disable-optimizations Disable all the built-in micro optimizations.