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 🙏

© 2025 – Pkg Stats / Ryan Hefner

node-jade-compress

v0.0.17

Published

An asynchronous JS/CSS compressor with CoffeeScript and Sass support.

Downloads

60

Readme

node-jade-compress

An asynchronous Javascript/Coffeescript & CSS/SASS compressor for the Jade templating engine.

DEPENDENCIES: coffee-script, connect, express, jade, mime, uglify-js, sqwish

How does it work?

Two filters: compress_js and compress_css are added to the Jade filter list. You can supply the js filter with either .js or .coffee local files, and the css filter with either .css or .scss local files. When the template is rendered, it simply creates a hash based on the filenames, and points them at a /cache directory. Any .js or .css requests to that directory are expected to be hashes, so we then look up what file cache is associated with that hash, check the mtime of each file vs the time the cache was created and decide if we need to regenerate the cache.

USAGE EXMAPLES:

IN JADE: block extra_css :compress_css normalize.css defaults.scss font.css game.scss

block extra_javascript
    include game/_game_js
    :compress_js
        game/main.coffee
        socket.io.js
        chat_client.coffee

The filters will look in following directories for the files: js : "#{cwd}/js" css : "#{cwd}/css" coffee : "#{cwd}/coffee" sass : "#{cwd}/sass"

IN YOUR APP: (example in Coffee) express = require 'express' coffee = require 'coffee-script' compress = require 'node-jade-compress' app = express.createServer() app.configure(-> app.use express.logger() app.use express.bodyParser() app.use express.cookieParser() app.use express.session {secret : 'scry', store : session_store} app.use app.router app.use express.static "#{cwd}/static" ) app.set 'view engine', 'jade' app.set 'view options', {layout: false} compress.views_init app

You supply the views_init function with your express app, which should be using Jade as the view engine of course (it's the Express default).

PROS:

  • This is asynchronous. It will not generate a cache while rendering the template.

  • You can combine .js/.coffee files and .css/.scss in a single compress_js or compress_css filter.

  • In a dev environment, this will not minify and compress the Javascript, but will run coffee for you and give back the individual files for better debugging.

CONS:

  • When the cache is invalidated, a new one won't be generated until a user visits, so the response time for that user to receive the .js/.css file will be much slower.

  • I haven't tested this in a proper production environment. It could probably use a lot of help.

  • We have to hardcode any includes we want to use in any of the SASS files. In the intereste of speed we can't look at every file, so "vars" and "mixins" have been hardcoded for now.

TODOs:

  • Module testing
  • Add support for non-local files in compress filters.
  • Handle someone requesting a cache file while it's being created.
  • Put hashes in a db, allow user to supply a store.
  • Allow user to specify the directories where files are, and where cache is stored.