基于Node.js的JavaScript项目构建工具gulp的使用教程(3)

var gulp = require('gulp'); var gulpLoadPlugins = require('gulp-load-plugins'); var plugins = gulpLoadPlugins(); plugins.jshint = require('gulp-jshint'); plugins.concat = require('gulp-concat');

gulp-babel:gulp 的babel插件,

$ npm install --save-dev gulp-babel babel-preset-es2015

使用方法:

const gulp = require('gulp'); const babel = require('gulp-babel'); gulp.task('default', () => { return gulp.src('src/app.js') .pipe(babel({ presets: ['es2015'] })) .pipe(gulp.dest('dist')); });

官方github: https://github.com/gulpjs/gulp

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzpdfw.html