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

gulp-commonizor

v0.1.1

Published

commonjs wrapper for js files.

Downloads

4

Readme

gulp-commonizor

plugin for building js file to support commonjs

最新版本

0.1.0

Getting Started

This plugin requires Gulp ~3.9.0

安装本插件:

npm install gulp-commonizor --save-dev

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

var commonizor = require('gulp-commonizor');

创建gulp任务

Overview

本gulp插件根据配置将对应文件(比如env.js)输出为.common.js文件(比如env.common.js),输出后的文件可以通过commonJS规范的require方法引入。配合tnpm publish命令打包发布到tnpm上:

tnpm publish

发布到npm以后可以直接通过以下方式引用该组件了:

var env = require('env');

Options

  • namespace: 发布到哪个名字空间(可选,值可以是'@ali'/'@alife'等,默认为'@ali')
  • name: 组件名字(可选,请按照组件命名规范命名,默认从package.json的name字段解析)
  • type: 组件类型(可选,值可以是lib/ctrl/app,默认从package.json的name字段解析)
  • pkg: 组件的package.json对象(可选,默认为根目录下的package.json)
  • dest: build目录的相对路径。(可选,默认为'./build'),如果pipe的目录不是build,这里应修改为对应的相对路径
  • concat: 是否多个文件拼接打包到一个common.js文件,默认为false

使用方法

在gulpfile.js里加入以下任务(如果要打包到成一个文件则使用concat参数):

// 方式一:打包每个文件成为单一的.common.js文件
gulp.task('common', function() {
	return gulp.src(['./build/a.js', './build/b.js'])
		.pipe(commonizor())
		.pipe(gulp.dest('./build'));
});

// 方式二:打包所有文件为一个.common.js文件
gulp.task('common', function() {
	return gulp.src(['./build/a.js', './build/b.js'])
		.pipe(commonizor({
			concat: true
		})).pipe(gulp.dest('build'));
});

在命令行里运行下面的命令即可打包出xxx.common.js文件。该文件支持commonjs依赖加载标准。

sudo gulp common