mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 11:17:19 +08:00
bundle task
This commit is contained in:
70
gulpfile.js
70
gulpfile.js
@ -23,6 +23,7 @@ var lazypipe = require('lazypipe');
|
||||
var cache = require('gulp-cached');
|
||||
var connect = require('gulp-connect');
|
||||
var Dgeni = require('dgeni');
|
||||
var insert = require('gulp-insert');
|
||||
|
||||
function getBabelOptions(moduleName, moduleType) {
|
||||
return {
|
||||
@ -50,18 +51,9 @@ var tscReporter = {
|
||||
}
|
||||
};
|
||||
|
||||
gulp.task('clean.build', function(done) {
|
||||
runSequence(
|
||||
'clean',
|
||||
'build',
|
||||
done
|
||||
);
|
||||
})
|
||||
|
||||
gulp.task('build', function(done) {
|
||||
runSequence(
|
||||
'transpile',
|
||||
'bundle.js',
|
||||
'bundle',
|
||||
'e2e',
|
||||
'sass',
|
||||
'fonts',
|
||||
@ -69,25 +61,22 @@ gulp.task('build', function(done) {
|
||||
);
|
||||
})
|
||||
|
||||
gulp.task('watch', function(done) {
|
||||
gulp.task('clean.build', function(done) {
|
||||
runSequence('clean', 'build', done);
|
||||
})
|
||||
|
||||
gulp.task('watch', function(done) {
|
||||
runSequence(
|
||||
'build',
|
||||
'serve',
|
||||
function() {
|
||||
watch(
|
||||
[
|
||||
watch([
|
||||
'ionic/**/*.js',
|
||||
'ionic/**/*.ts',
|
||||
'!ionic/components/*/test/**/*',
|
||||
'!ionic/util/test/*'
|
||||
],
|
||||
function() {
|
||||
runSequence(
|
||||
'transpile',
|
||||
'bundle.js',
|
||||
'e2e'
|
||||
)
|
||||
runSequence('transpile', 'bundle.js', 'e2e');
|
||||
}
|
||||
);
|
||||
|
||||
@ -104,6 +93,10 @@ gulp.task('watch', function(done) {
|
||||
);
|
||||
});
|
||||
|
||||
gulp.task('build.watch', function(done){
|
||||
runSequence('build', 'watch');
|
||||
})
|
||||
|
||||
gulp.task('serve', function() {
|
||||
connect.server({
|
||||
root: 'dist',
|
||||
@ -144,20 +137,39 @@ gulp.task('transpile.system', function() { return transpile("system"); });
|
||||
gulp.task('transpile.common', function() { return transpile("common"); });
|
||||
gulp.task('transpile', ['transpile.system']);
|
||||
|
||||
gulp.task('bundle.js', function() {
|
||||
return gulp.src(['dist/js/es5/system/ionic/**/*.js', 'ionic/util/hairline.js'])
|
||||
.pipe(concat('ionic.bundle.js'))
|
||||
.pipe(gulp.dest('dist/js/'));
|
||||
gulp.task('bundle.ionic', ['transpile'], function() {
|
||||
return gulp.src([
|
||||
'dist/js/es5/system/ionic/**/*.js',
|
||||
'ionic/util/hairline.js'
|
||||
])
|
||||
.pipe(concat('ionic.js'))
|
||||
.pipe(insert.append('System.config({ "paths": { "ionic/*": "ionic/*" } });'))
|
||||
.pipe(gulp.dest('dist/js/'));
|
||||
//TODO minify + sourcemaps
|
||||
});
|
||||
|
||||
gulp.task('bundle', ['bundle.ionic'], function() {
|
||||
var nm = "node_modules";
|
||||
return gulp.src([
|
||||
'node_modules/traceur/bin/traceur-runtime.js',
|
||||
'node_modules/systemjs/node_modules/es6-module-loader/dist/es6-module-loader.js',
|
||||
'node_modules/systemjs/dist/system.js',
|
||||
'node_modules/angular2-build/angular2.dev.js',
|
||||
'dist/js/ionic.js',
|
||||
'node_modules/web-animations-js/web-animations.min.js'
|
||||
])
|
||||
.pipe(concat('ionic.bundle.dev.js'))
|
||||
.pipe(gulp.dest('dist/js'));;
|
||||
})
|
||||
|
||||
gulp.task('tests', function() {
|
||||
return gulp.src('ionic/components/*/test/*/**/*.spec.ts')
|
||||
.pipe(tsc(tscOptions, null, tscReporter))
|
||||
.pipe(babel(getBabelOptions('tests')))
|
||||
.pipe(rename(function(file) {
|
||||
file.dirname = file.dirname.replace(path.sep + 'test' + path.sep, path.sep)
|
||||
}))
|
||||
.pipe(gulp.dest('dist/tests'))
|
||||
.pipe(tsc(tscOptions, null, tscReporter))
|
||||
.pipe(babel(getBabelOptions('tests')))
|
||||
.pipe(rename(function(file) {
|
||||
file.dirname = file.dirname.replace(path.sep + 'test' + path.sep, path.sep)
|
||||
}))
|
||||
.pipe(gulp.dest('dist/tests'))
|
||||
})
|
||||
|
||||
gulp.task('copy-scripts', function(){
|
||||
|
@ -20,6 +20,7 @@
|
||||
"gulp-connect": "^2.2.0",
|
||||
"gulp-debug": "~2.0.1",
|
||||
"gulp-if": "^1.2.5",
|
||||
"gulp-insert": "^0.5.0",
|
||||
"gulp-plumber": "^1.0.0",
|
||||
"gulp-rename": "~1.2.0",
|
||||
"gulp-sass": "^1.3.3",
|
||||
@ -44,5 +45,12 @@
|
||||
"typescript": "^1.5.3",
|
||||
"vinyl": "^0.4.6",
|
||||
"yargs": "^3.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"angular2-build": "2.0.0-alpha.33",
|
||||
"systemjs": "^0.16.11",
|
||||
"traceur": "0.0.91",
|
||||
"traceur-runtime": "0.0.59",
|
||||
"web-animations-js": "tlancina/web-animations-js"
|
||||
}
|
||||
}
|
||||
|
@ -39,22 +39,21 @@
|
||||
<ion-loading-icon></ion-loading-icon>
|
||||
</ion-app>
|
||||
|
||||
<!-- SystemJS Loader -->
|
||||
<script src="../../../lib/traceur-runtime.js"></script>
|
||||
<!-- <script src="../../../lib/traceur-runtime.js"></script>
|
||||
<script src="../../../lib/system.js"></script>
|
||||
<script src="../../../lib/e2e.config.js"></script>
|
||||
|
||||
<!-- Angular bundle -->
|
||||
<script src="../../../lib/angular2.dev.js"></script>
|
||||
|
||||
<!-- test module -->
|
||||
<script src="index.js"></script>
|
||||
|
||||
<!-- ionic bundle -->
|
||||
<script src="../../../lib/ionic.bundle.js"></script>
|
||||
|
||||
<!-- web animations polyfill for non-chrome browsers -->
|
||||
<script src="../../../lib/web-animations.min.js"></script>
|
||||
<script src="../../../lib/web-animations.min.js"></script> -->
|
||||
|
||||
<script src="../../../js/ionic.bundle.dev.js"></script>
|
||||
|
||||
<script>System.config({"baseURL": "../../../"})</script>
|
||||
<script>System.import("{{MODULE}}");</script>
|
||||
|
||||
</body>
|
||||
|
@ -1,8 +1 @@
|
||||
System.config({
|
||||
"baseURL": "/",
|
||||
"transpiler": "traceur",
|
||||
"paths": {
|
||||
"*": "*.js",
|
||||
"ionic/*": "ionic/*"
|
||||
}
|
||||
});
|
||||
System.config({ "paths": { "ionic/*": "ionic/*" } });
|
||||
|
@ -1,8 +0,0 @@
|
||||
System.config({
|
||||
"baseURL": "../../../",
|
||||
"transpiler": "traceur",
|
||||
"paths": {
|
||||
"*": "*.js",
|
||||
"ionic/*": "ionic/*"
|
||||
}
|
||||
});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user