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

grunt-pepper

v0.5.8

Published

coffee-script tool: adds info objects to log calls, inserts data from json files and generates ascii-art headers.

Readme

grunt-pepper

... a little tool that parses my coffee-script files before they get translated to javascript.

It replaces log function calls with alternative calls that receive an info object as its first argument.

The info object contains the file-path and line-number as well as class-, method- and agrument-names of the place where the log occurred.

For example, in a file ./drink/some.coffee ...

class Hello

  sayHello: =>
    # ... it would replace the following log:
    log "hello", "world!"

    # ... with this one:
    log {file: 'drink/some.coffee', line: 5, class: 'Hello', method: 'sayHello'},
        "hello", "world"

It can also replace special markers with values from a json file:

# ... the following:

@version = '::package.json:version::'

# ... gets replaced by:

@version = '1.2.3'

Installation

npm install grunt-pepper --save-dev

Gruntfile.coffee

module.exports = (grunt) ->

  grunt.initConfig

    pepper:
      options:
        dryrun:   false      # if true, no files are written,
                             # just prints what would be done
        verbose:  false      # if true, the parse result is printed to stdout
        quiet:    false      # if true, almost no information is printed
        join:     true       # if true, files are joined into one target file
        outdir:   '.pepper'  # directory where the parse results are written to
        type:     '.coffee'  # suffix of the parse result files
        template: '::'       # replaces ::file.json:key:: with value of
                             # property key from object in file.json
                             # set to false to disable templating
                             
        pepper: ['console.log']
        
                # function calls that get peppered
                #
                # if specified as a map:
                #       key:   original function name that gets replaced
                #       value: replacement function that gets called instead
                #
                # if specified as a list:
                #       preserves the original function names
                #
                #  the replacement function receives one additional 1st argument:
                #       an object with keys: file, line, method, type, args
                
        paprika: ['dbg']
        
                # names of functions that get paprikaed :-)
                #
                # same as pepper, but variable arguments get
                #                 prefixed with their names:
                #  
                # dbg foo, bar
                # 
                # gets replaced with
                #
                # dbg {...pepper...}, 'foo:', foo, 'bar:', bar

        paprikaPrefix:  ''
        paprikaPostfix: ':'
                
    task:
      files:
        'spiced': [ file(s) ] # will parse all file(s) and write the result
                              # to file '.pepper/spiced.coffee' if join is true
                              # if join is false, the original file structure 
                              # will be replicated in outdir

  grunt.loadNpmTasks 'grunt-pepper'

Have a look at the Gruntfile of my other pet project if you need another example.

... and salt ...

In addition to the pepper task, there is another task which is called salt.

It can add an ascii header to files which start with an empty block comment.

For example, in a file salt.coffee it would replace ...

###
###

... with the following header:

###

 0000000   0000000   000      000000000
000       000   000  000         000   
0000000   000000000  000         000   
     000  000   000  000         000   
0000000   000   000  0000000     000   

###

I think these headers give me a nicer looking minimap:

minimap

Gruntfile.coffee

    salt:
        options:
            dryrun:        false
            quiet:         false
            verbose:       true
        headers:
            options:
                headerStart : "###" # filename will be put between this ...
                headerEnd   : "###" # ... and this marker                
                refresh     : false # if true, it will replace all ascii headers, 
                                    # false: only empty block comments are filled
            files:
                'asciiHeader': ['./coffee/**/*.coffee']
                
        # 'asciiText' mode replaces special comments with ascii art text 
        #                  anywhere in the specified files:

        coffee: 
            textMarker  : "#!!" #   text following this comment will be transformed
            textPrefix  : "###" #   this is put before the replacing lines
            textFill    : ""    #   each replacing line starts with these characters
            textPostfix : "###" #   this is put after the replacing lines
            files:
                'asciiText': ['./coffee/**/*.coffee']

        # this is what I use to generate text in my stylus files:
        
        style:
            options:
            textMarker  : "//!!" #   text following this comment will be transformed
            textPrefix  : "/*"
            textFill    : "* "  
            textPostfix : "*/"  
            files:
                'asciiText': ['./style/*.styl']

This stuff works for me, but I won't guarantee that it works for you as well. Therefore: don't forget to backup your files before you try it out! use at your own risk!

npm grunt