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

gulp-jspm

v0.5.13

Published

gulp plugin to build assets loaded with jspm/SystemJS

Downloads

319

Readme

gulp-jspm wraps the jspm bundle moduleName command line.

Usage

var gulp = require('gulp');
var gulp_jspm = require('gulp-jspm'); // npm install gulp-jspm

gulp.task('default', function(){
    return gulp.src('src/main.js')
        .pipe(gulp_jspm())
        .pipe(gulp.dest('build/'));
});

This will generate the demo/build/jspm-bundle.js file. This file corresponds to the file generated by the command jspm bundle main.

Many code snippets shown in this Readme are implemented at demo/gulpfile.js.

Before Opening an Issue

When opening an issue, copy the debug logs in the ticket. The debug logs are printed when running gulp-jspm with the verbose option gulp_jspm({verbose: true}).

Source Map
var sourcemaps = require('gulp-sourcemaps');

gulp.src('src/main.js')
    .pipe(sourcemaps.init())
    .pipe(gulp_jspm())
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest('build/'));
Options
// exclude message.js from bundle
gulp.src('src/main.js')
    .pipe(gulp_jspm({arithmetic: '- message'}))
    .pipe(gulp.dest('build/'));

// `jspm bundle-sfx main`
gulp.src('src/main.js')
    .pipe(gulp_jspm({selfExecutingBundle: true}))
    .pipe(gulp.dest('build/'));

// `jspm bundle main.jsx!`
gulp.src('src/main.jsx')
    .pipe(gulp_jspm({plugin: true}))
    .pipe(gulp.dest('build/'));

// `jspm bundle main.jsx!jsx`
gulp.src('src/main.jsx')
    .pipe(gulp_jspm({plugin: 'jsx'}))
    .pipe(gulp.dest('build/'));

// print information logs about the internal progress of `gulp-jspm`
gulp.src('src/main.js')
    .pipe(gulp_jspm({verbose: true}))
    .pipe(gulp.dest('build/'));

// rename the bundled file
gulp.src('src/main.js')
    .pipe(gulp_jspm({fileName: 'other-name'})) // do not include file extension
    .pipe(gulp.dest('build/'));

// All other options given to gulp-jspm are passed on to jspm.
// All jspm options can therefore be passed to `gulp-jspm`
// (`minify`, `mangle`, `lowResSourceMaps`, etc.).
// For example:
gulp.src('src/main.js')
    .pipe(gulp_jspm({inject: true})) // `jspm bundle main --inject`
    .pipe(gulp.dest('build/'));
Original Entry Point
gulp.src('src/main.js')
    .pipe(gulp_jspm())
    .pipe(pass(function(vinyl_file){
        assert( vinyl_file.relative === 'main.bundle.js' );
        assert( vinyl_file.originalEntryPoint.relative === 'main.js' );
    }));

Run Gulpfile Demo

To run the code snippets above execute following commands.

git clone [email protected]:brillout/gulp-jspm
cd gulp-jspm/
npm install
cd demo/
npm install
npm install -g jspm
npm install -g gulp
jspm install
gulp
gulp sourcemap
gulp test