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

minimus

v0.1.3

Published

Asset bundler for express.js apps with S3 deployment option

Downloads

6

Readme

Minimus

Asset bundler and deployer for node and S3.

Install

The project can be install with npm. In the package.json file add:

{
    ....
    "minimus": "0.1.2",
    ...
}

Configuring

The minimus module should be laoded in your primary node app file (app.js, web.js, server.js, etc).

var minimus = require('minimus');

var assets = minimus({
    assetsFile:     __dirname + '/config/assets.yml',   // path to asset file (below)
    minify:         false                               // pass in boolean based on NODE_ENV
});

and then added as middleware in configure.

app.configure(function () {
    ...
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    
    app.use(assets);
    
    app.use(app.router);
    ...
});

Asset File

s3:             # where css, js, and jst will be minified and deployed when ```minify: true```
    key: foo
    secret: bar
    bucket: baz

javascripts:
    modernizr:
        - public/javascripts/_vendor/modernizr.min.js

    common:
        # core
        - public/javascripts/_vendor/plugins.js
        - public/javascripts/_vendor/bootstrap-min.js

        # views
        - public/javascripts/views/foos/super-special-view.js
        - public/javascripts/views/foos/*
        - public/javascripts/views/bars/*

        # templates
        - public/templates/foos/*
        - public/templates/bars/*

stylesheets:
    common:
        - public/stylesheets/_vendor/*
        - public/stylesheets/site.css

Wilcards

Please note only one level of wildcard mapping is supported.

- public/javascripts/views/foos/*       # will match all files in the foos dir

Will not work:

- public/javascripts/views/*            # will match all files in the views dir, not in the child dirs below

Using

In Express 3.x minimus is run as middleware adding the following to res.locals:

stylesheets
javascripts

These are included in views with a function call:

<%- stylesheets('sectionName') %>

where sectionName is a section from the assets.yml file above.

Deploying

The following command will read the assets.yml file and deploy to the specified Amazon S3 bucket.

node_modules/minimus/bin/minimus

Setting the minify option to true in the minimus function will use the specified S3 bucket for the assets.

Images

Images are not deployed as part of this process; they must be uploaded manually.

Express 2.x Sample

Minimus supports Express 2.x apps through helpers.


// inside app.configure

minimus = minimus({
    express3: false,
    useMinified: false,
    yamlFilePath: __dirname + '/config/assets.yml'
});

...

//
// helpers
//

app.dynamicHelpers ({
    javascripts: function (req, res) {
        return function (name) {
            return minimus.javascripts(name);
        }
    },
    stylesheets: function (req, res) {
        return function (name) {
            return minimus.stylesheets(name);
        }
    }
});