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-superjoin

v0.1.0

Published

Grunt plugin for superjoin the module loader for the web

Downloads

1

Readme

grunt-superjoin

Grunt plugin for superjoin the module loader for the web

Getting Started

This plugin requires Grunt ~0.4.5

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-superjoin --save-dev

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

grunt.loadNpmTasks('grunt-superjoin');

The "superjoin" task

Overview

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

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

Options

options.dev

Type: String Default value: false

Enables develop mode. Superjoin loads local modules automatically by using XHR if it isn't within the bundle. Use this flag in develop mode only.

option.root

Type: String Default value: Same folder where the Gruntfile.js file is.

Changes the default web root folder. For example if you store all public files under public, then set this flag to public/

option.banner

Type: String Default value: ''

Adds a banner at the beginning of the bundle.

Example:

grunt.initConfig({
  pkg: grunt.readJSON('package.json'),
  superjoin: {
    dist: {
      options: {
        banner: '/*!\n * My Superbundle v<%= pkg.version %>\n */'
      }
    }
  }
});

Produces:

/*!
 * My Superbundle v0.1.0
 */

 <bundle code goes here ...>

Params

src

Type: Array|String

Configures all required modules. If this property is not present, then Superjoin tries to read the files configuration from a superjoin.json or package.json file

dest

Type: String Default: <%= pkg.name %>.js

Defines the filename for the output file

Usage Examples

This example loads jquery from node_modules folder and and module1.js and module2.js from public/src/ folder The project root is set per default to the folder where your Gruntfile.js file is. To change the public root folder, set the root option. Superjoin creates a bundle of all these modules and writes it to public/mybundle.js

Local modules must start with ./ otherwise superjoin looks in node_modules folder for that module.

grunt.initConfig({
  superjoin: {
    dist: {
      options: {
        root: 'public/'
      },
      src: ['jquery', './src/module1.js', './src/module2.js'],
      dest: 'mybundle.js'
    }
  }
});

superjoin.json

Superjoin looks for a superjoin.json file in your project dir. If no file was found it looks into the package.json file for a superjoin property. You can use one of this methods to define your module paths.

More about superjoin.json

Superjoin looks for a file in this order

<project root>/<web root>/superjoin.json
<project root>/superjoin.json
<project root>/package.json (using the superjoin property)

A Gruntfile configuration overrides a Superjoin config property. For example, if a Superjoin files option was found and the src property in the Gruntfile was set, then the Gruntfile property will be used.