Created
February 23, 2015 21:49
-
-
Save dan-gamble/daf1995c5895622bdde5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gulp = require('gulp'); | |
| var shell = require('gulp-shell'); | |
| var inject = require('gulp-inject'); | |
| var replace = require('gulp-html-replace'); | |
| var concat = require('gulp-concat'); | |
| var uglify = require('gulp-uglify'); | |
| var runSequence = require('run-sequence'); | |
| gulp.task('js', function() { | |
| return gulp.src(['jspm_packages/traceur-runtime.js', 'build.js']) | |
| .pipe(concat('app.js')) | |
| .pipe(uglify()) | |
| .pipe(gulp.dest('.')); | |
| }); | |
| gulp.task('jspm', shell.task([ | |
| 'jspm bundle-sfx --minify lib/main' | |
| ])); | |
| gulp.task('build', runSequence('jspm', 'js'), function() { | |
| var target = gulp.src('./index.html'); | |
| var sources = gulp.src(['app.js']); | |
| target.pipe(inject(sources)) | |
| .pipe(gulp.dest('.')); | |
| return target.pipe(inject( | |
| gulp.src(['./import.js']), { | |
| starttag: '<!-- inject:jsdev -->', | |
| transform: function(filepath, file) { | |
| return inject.transform.apply(''); | |
| } | |
| })) | |
| .pipe(gulp.dest('.')); | |
| }); | |
| gulp.task('dev', function() { | |
| var target = gulp.src('./index.html'); | |
| var sources = gulp.src(['jspm_packages/system.js', 'config.js']); | |
| target.pipe(inject(sources)) | |
| .pipe(gulp.dest('.')); | |
| return target.pipe(inject( | |
| gulp.src(['./import.js']), { | |
| starttag: '<!-- inject:jsdev -->', | |
| transform: function(filepath, file) { | |
| return file.contents.toString('utf8') | |
| } | |
| })) | |
| .pipe(gulp.dest('.')); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment