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-jspm-builder

v0.3.1

Published

A Grunt task for bundling based on all jspm production workflows.

Downloads

36

Readme

grunt-jspm-builder

Install

$ npm install --save-dev grunt-jspm-builder

Usage

The grunt-jspm-builder provides all jspm production workflows via most SystemJS APIs.

grunt.loadNpmTasks('grunt-jspm-builder');

Monolithic Bundle

Build a single monolithic bundle including all 3rd party libraries.

grunt.initConfig({
    // ...
	jspm: {
		monolithicBundle: {
            options: {
                sfx: true,
                minify: true,
                mangle: true,
                sourceMaps: false
            },
            files: {
                "build/js/app.js": "src/app.js"
            }
		}
    }
    // ...
});

Extract 3rd party dependencies

Extract all 3rd party dependencies from your project and place them in a separate bundle.

grunt.initConfig({
    // ...
    jspm: {
        extractDeps: {
            options: {
                sfx: false,
                minify: true,
                sourceMaps: false,
                inject: true, // important for jspm projects only
                mangle: true
            },

            files: {
                "build/js/libs/dependencies.js": "js/**/* - [src/**/*]"
            }
        }
    }
    // ...
});

Exclude specific bundles or 3rd party dependencies.

Builds the project excluding the specified bundles or source trees using arithmetic and/or module syntax.

grunt.initConfig({
    // ...
    jspm: {
        excludeBundles: {
            options: {
                sfx: false,
                minify: true,
                mangle: true,
                sourceMaps: false
            },
            files: {
                // Exclude all 3rd party dependencies and mock data from the build.
                // This task assumes that build/js/libs/dependencies exists 
                "build/js/app.js": "js/app - build/js/libs/dependencies - [js/mockData/**/*]"
            }
        }
    }
    // ...
});

Create a Common Bundle

Build the dependencies in common between 2 modules including all project-level and 3rd party dependencies.

grunt.initConfig({
    // ...
    jspm: {
        createCommon: {
            options: {
                sfx: false,
                minify: true,
                mangle: true,
                sourceMaps: false,
                inject: true // important for jspm builds only
            },
            files: {
                "build/js/common.js": "js/modules/module1 & js/modules/module2"
            }
        }
    }
    // ...
});

Bundle Dependencies between 2 or More Source Trees

Compare 2 or more bundles using arithmetic, extract their common dependencies and place them in a separate bundle and then build all the bundles.

grunt.initConfig({
    // ...
    jspm: {
        commonOption2: {
            // Options for bundles
            options: {
                sfx: false,
                minify: false,
                mangle: false,
                sourceMaps: true
            },
            files: {
                // Exclude core-libs from the comparison
                // since it is it's own bundle.
                "build/modules/module1": "js/modules/module1 - core-libs",
                "build/modules/module2": "js/modules/module1 - core-libs"
            },
            // The 'commonBundle' Object is required in order
            // to tell the builder to compare the above source 
            // trees and create a bundle containing common deps.
            commonBundle: {
                // options for building the common bundle
                options: {
                    sfx: false,
                    minify: false,
                    sourceMaps: false,
                    inject: true, // important!
                    mangle: true
                },
                dest: 'build/js/common.js'
            }
        }
    }
    // ...
});

Options

All available options follow those used on SystemJS builds.

sfx

Default: true

Creates a single self-executing bundle for a module (Not available using bundle arithmetic).

minify

Default: true

Use minification, defaults to true.

mangle

Default: true

Use mangling with minification, defaults to true

sourceMaps

Default: false

include or exclude source maps in the build, defaults to false

injectConfig

Default: false

When true, inject the bundle tree into the configuration file. This is especially important when building one or more common bundles.

License

MIT © Justin Wilaby