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-coffee-chain

v1.2.5

Published

grunt's task for concatenating CoffeeScript files that have 'require' directive using Snockets

Downloads

38

Readme

grunt-coffee-chain

grunt plugin inspired by Sprockets to compile CoffeeScripts that has sprockets-style comments to indicate dependencies.

Usage (script-side)

In your CoffeeScript files, write Sprockets-style comments to indicate dependencies, e.g.

#= require dependency

If you want to bring in a whole folder of scripts, use

#= require_tree dir

Usage (grunt-side)

This plugin requires Grunt ~0.4.1

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-coffee-chain --save-dev

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

grunt.loadNpmTasks('grunt-coffee-chain');

The "coffeeChain" task

Overview

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

grunt.initConfig({
  coffeeChain: {
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
})

Options

options.clean

(Not yet implemented) Type: Booleann Default value: false

A boolean value that is used to clean resulting CoffeeScript from useless code that coffee compiler adds.

Usage Examples

Default Options

In these examples, the default options are used to compile coffee scripts to js without cleaning them`

grunt.initConfig({
  coffeeChain: {
    options: {},
    your_target: {
      src:  'app/assets/javascripts/main.coffee',
      dest: 'public/assets/app.js'
    }
  },
})
grunt.initConfig({
  coffeeChain: {
    your_target: {
      src:  'app/assets/javascripts/main.coffee',
      dest: 'public/assets/app.js'
    }
  },
})

Custom Options

In this example, the custom options are used to compile coffee scripts to js cleaning them`

grunt.initConfig({
  coffeeChain: {
    your_target: {
      options: {
        clean: true
      },
      src:  'app/assets/javascripts/main.coffee',
      dest: 'public/assets/app.js'
    }
  },
})

CoffeeScript Examples

In this example, the custom options are used to compile coffee scripts to js minifying and cleaning them`

grunt.initConfig
  coffeeChain:
    dist:
      options:
        clean: true
      src: "app/main.coffee"
      dest: "dist/index.js"

Contributing

This application is written in CoffeeScript with sprockets-style comments to indicate dependencies and so

it compiles itself to javascript using previous version of itself.

When you change something in this app it is better to compile tests using previous version of this app as we use coffee_chain to compile coffee_chain to itself and need to protect us from testing application using incorrectly compiled tests. So to run tests I have added a simple script that should be used instead of 'npm test' command:

  ./compile

Release History

version 1.2.5 - Current. Updated coffeeChain to save all data to a temp file and only when everything is complete overwrite the destination file

version 1.2.2 - the same as previous version but compiled from coffee to js using coffeeChain 1.2.1

version 1.2.1 - refactored from scratch. It was compilled in common node.js way

Note: versions 0.1.2 - 1.2.0 and v1.2.3 - 1.2.4 : some of them are incorrect and may be broken. Use any higher version