ionic tutorial - By using gulp-babel and gulp-plumber in Ionicframework - ionic framework - ionic 2 - ionic creator - ionic development



Ionic uses Gulp, so install gulp-babel and gulp-plumber.

npm install --save-dev gulp-babel gulp-plumber
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

Add babel to gulpfile.js like so:

//...
var babel = require("gulp-babel");
var plumber = require("gulp-plumber");
 
var paths = {
  es6: ['./src/es6/*.js'],
  sass: ['./scss/**/*.scss']
};
  
gulp.task('default', ['babel', 'sass']);
 
gulp.task("babel", function () {
  return gulp.src(paths.es6)
    .pipe(plumber())
    .pipe(babel())
    .pipe(gulp.dest("www/js"));
});
  
//...
  
gulp.task('watch', function() {
  gulp.watch(paths.es6, ['babel']);
  gulp.watch(paths.sass, ['sass']);
});
//...
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

Edit ionic.project:

"gulpStartupTasks": [
    "babel",
    "sass",
    "watch"
 ],
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

Now when you run ionic serve, code will be transpiled for you.


Related Searches to By using gulp-babel and gulp-plumber in Ionicframework