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

igneous

v0.1.6

Published

Automatic asset bundling and deployment

Downloads

51

Readme

Igneous 0.1.6

Simple asset compilation middleware for Connect and Express.

Igneous helps keep asset management easy by merging groups of assets down to single files. These files can be pre/post-processed in a variety of ways, including minification, coffeescript, SASS/LESS, and client-side javascript template compilation. Igneous can also watch files and directories (including subdirectories) for changes and automatically regenerate bundles on the fly.

Note: This module are still in flux. If you plan on using this right now it might be wise to include the exact version number, as some parts of the API might change.

Installation

To install Igneous, just use npm:

npm install igneous

Usage

Igneous is Connect middleware, meaning it must be used via Connect or something that extends it, like Express.

Igneous uses a simple configuration method to define groups of assets—called "flows"—along with some pre/post-processing options:

var igneous = require('igneous');

var igneous_middleware = igneous({
	root: __dirname +'/assets/',
	minify: true,
	flows: [
		{
			route: 'scripts/application.js',
			type: 'js',
			paths: [
				'toolbar.js',
				'home.js',
				'app.coffee'
			]
		}
	]
})

After the middleware is configured, it just needs to be used:

var express = require('express');
express.use( igneous_middleware );

Client-side javascript templates can also be compiled by Igneous. Right now it's limited to just Mustache, Handlebars and jQuery templates, but as time goes on more template packages will be added. An example of a Handlebars configuration:

igneous({
	root: __dirname +'/assets',
	minify: true,
	flows: [
		route: 'templates.js',
		type: 'jst',
		base: '/templates/',
		paths: [
			'test1.jst',
			'test2.jst',
			'_partial.jst'
		],
		jst_lang: 'handlebars',
		jst_namespace: 'templates'
	]
})

These templates will be made available on the jst_namespace, with each template being associated with the string used for its path. For example, to access the template 'test1.jst' from above:

templates['test1']({ test: 'My radical template data' });

For more usage details, take a look at the examples directory!

Parameters

Igneous can be configured to run in a variety of ways. Some options, such as root, are set globally, while other options, such as route are set per flow. Other options, like minify, may be set globally and overriden on a per-flow basis.

Global Parameters

  • root - (string) - The root directory to check for assets.
  • minify (boolean) - Minify the assets after compilation. Defaults to false.
  • watch (boolean) - Watch the flow paths for changes. Defaults to true.
  • encoding (string) - The file encoding to be used for each flow. Defaults to UTF-8
  • flows (array) - An array of flow configuration objects.

Flow Parameters

  • route (regex/string) - The route to use for this generated file.
  • type (string - "js", "css", "jst") - The type of files included in this flow.
  • extensions (array - ['js','coffee','cs']) - An array of strings that represent file extensions to look for. Extensions appropriate for the type are automatically added ( ex: ['css', 'less', 'sass', 'scss'] for a type of css )
  • minify (boolean) - Minify the assets after compilation. Overrides the global minify parameter.
  • watch (boolean) - Watch the flow paths for changes. Overrides the global watch parameter.
  • encoding (string) - The file encoding to be used for this flow. Overrides the global encoding parameter.
  • jst_lang (string - "mustache", "handlebars", "jquery-tmpl") - The language to use if this is a javascript template flow.
  • jst_namespace (string) - The variable name to make the compiled templates available on. Defaults to JST
  • paths (array) - An array of strings representing the paths to include in this flow. These paths can be files or folders. If a folder is specified, Igneous will walk through the folder and include every file found within, including subfolders.

Tests

You can run Igenous' tests with the command npm test. These tests require Mocha to run.

Future Plans

In no specific order:

  • Automatic Amazon S3 deployment
  • Custom pre/post-processors
  • Custom store strategies
  • Additional test coverage
  • Additional JST options

License

MIT License.


Copyright © 2012 Timothy Kempf

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.