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

grunt-asset-smasher

v0.1.1

Published

Run asset-smasher from Grunt

Downloads

19

Readme

grunt-asset-smasher

Grunt plugin for asset-smasher

See the asset-smasher homepage for more details on usage of asset-smasher and how it works.

Getting Started

This plugin requires Grunt ~0.4.1 and asset-smasher ~0.3.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-asset-smasher --save-dev

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

grunt.loadNpmTasks('grunt-asset-smasher');

The "asset_smasher" task

Overview

In your project's Gruntfile, add a section named asset_smasher to the data object passed into grunt.initConfig().

grunt.initConfig({
  asset_smasher: {
    options: {
      // asset-smasher options go here
    },
    dist: {
    }
  },
})

Options

options.outputTo

Type: String Default value: No Default. This must be specified

The directory to output assets into

options.paths

Type: String[] Default value: [process.cwd()]

An array of asset paths

options.only

Type: String[] Default value: ['**/*.*']

Array of glob patterns for assets that should be output (other assets will be filtered out/not processed)

options.prefix

Type: String Default value: ''

Prefix to append to logical paths when constructing urls. use if output dir is not served from the root of your web app

options.compress

Type: Boolean Default value: false

Whether to compress JavaScript and CSS assets

options.hash

Type: Boolean Default value: false

Whether to output copies of the final assets with an MD5 hash of the contents appended to the file name (e.g. myasset-xxxxxxxxxxxxxxxxxxxx.js)

options.gzip

Type: Boolean Default value: false

Whether to output a copy of the final assets gzipped

options.hashVersion

Type: String Default value: 1.0

Change this value if you want to invalidate all of your assets (the version is included when computing the hash value for an asset)

options.helpers

Type: Object Default value: {}

Helpers/values to pass into transformers (e.g. the ejs transformer exposes these as local variables)

options.amd

Type: Boolean|Object Default value: false

Whether to enable AMD module support. Either a boolean can be passed in, or an object of the form

{
  baseLogicalPath: 'base/path' // The value defaults to '' and will be stripped off of all logical paths before constructing module ids
}

options.verbose

Type: Boolean Default value: false

Whether verbose information should be printed out to stdout when compiling

options.noclean

Type: Boolean Default value: false

Whether to prevent deletion of the output directory before compilation

Usage Examples

Basic Options

This will compile all files in my/assets and output them to output/dir

grunt.initConfig({
  asset_smasher: {
    options: {
      paths: ['my/assets'],
      outputTo: 'output/dir'
    }
  },
})

More Advanced Options

This compiles only the manifest files in several asset paths, compresses the result, and creates hashed versions of the files.

grunt.initConfig({
  asset_smasher: {
    options: {
      paths: ['my/assets', 'my/otherassets'],
      outputTo: 'output/dir',
      only: ['**/*.mf'],
      prefix: 'assets',
      compress: true,
      hash: true
    }
  },
})

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

0.1 (June 20, 2013)

Initial release - Compatible with asset-smasher 0.3.x