• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

brillout/gulp-jspm: gulp plugin to build assets loaded with jspm/SystemJS

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

brillout/gulp-jspm

开源软件地址(OpenSource Url):

https://github.com/brillout/gulp-jspm

开源编程语言(OpenSource Language):

JavaScript 98.7%

开源软件介绍(OpenSource Introduction):

Currently unmaintained, see issue #45 - Looking for a maintainer / fork



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 git@github.com: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



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap