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

alljsmin

v1.0.5

Published

Minify all js files and merge specified js files to all.js

Downloads

5

Readme

alljsmin

alljsmin does:

  1. Minify all js files in specified input dir to output dir
  2. Merge some js files to all.js (identified by @all.js in tag file)
  3. Tweak 'const is_debug = true' to 'const is_debug = false' for release

alljsmin是一款小工具,方便release js相关的项目。

  1. 它会minify所有js文件,也可排除若干文件。
  2. 根据指定的标签文件(tag file),它会搜索@all.js,将前后@all.js行当中的部分做解析,将得到的 所有文件合并为一个all.js并minify。
  3. 它也会将js中'const is_debug = true'替换为'const is_debug = false'。使用is_debug的 好处是区分开发模式和release模式,release下某些功能可能要禁用了,如右键菜单等。

Installation

$ [sudo] npm install -g alljsmin

Usage

Usage:
  alljsmin [OPTIONS] [input_dir [output_dir]]

Options:
  -h, --help: Help
  -v, --version : Version

Arguments:
input_dir : input dir
output_dir: optional, default: ${input_dir}.min

Note:
  If no input_dir specified and exists src dir, use it as input_dir.

Configuration: alljsmin.json

File: ${input_dir}/alljsmin.json.

Sample contents:

{
  "tag_file": "js/background.js",
  "is_debug_file": "js/log.js",
  "remove_files": [
    "jsconfig.json"
  ],
  "excludes": [
    "video_popup"
  ],
  "toplevels": [
    "js/all.js",
    "js/background.js"
  ]
}

tag_file

Search @all.js tag, merge contained files to all.js.

For example, in tag file main.html:

......
<!-- @all.js -->
<script src="js/a.js"></script>
<script src="js/b.js"></script>
<!-- @all.js -->
......

Will translate to:

......
<script src="js/all.js"></script>
......

These will merge “js/a.js”, “js/b.js” to “js/all.js” and minify it.

Another example, in tag file background.js:

......
  } else if (request.cmd === 'inject-detail') {
    const all_js = [
      /* @all.js */
      'js/bytesrep.js',
      'js/string_path.js',
......
      'js/content_script.js',
      /* @all.js */
    ]
    for (const file of all_js) {
      chrome.tabs.executeScript(sender.tab.id,
          {allFrames: true, frameId: sender.frameId, file});
......

Will translate to:

......
  } else if (request.cmd === 'inject-detail') {
    const all_js = [
      'js/all.js',
    ]
    for (const file of all_js) {
      chrome.tabs.executeScript(sender.tab.id,
          {allFrames: true, frameId: sender.frameId, file});
......

These will merge “js/bytesrep.js”, “js/string_path.js”, ..., "js/content_script.js" to “js/all.js” and minify it.

is_debug_file

Replace 'const is_debug = true' with 'const is_debug = false'

release模式下设置is_debug为false,以禁用某些功能

remove_files

Remove these file in output dir.

删除release模式下不需要的文件。

excludes

Wildcard patterns for exclude some dir or files from minify.

排除目录或文件列表,可使用通配符。

toplevels

Minify matched js files with option toplevel: true.