当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
8 Star 15 Fork 5

jindong5210/engine7
暂停

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
gulpfile.js 2.99 KB
一键复制 编辑 原始数据 按行查看 历史
jindong 提交于 2017-03-29 21:56 . AJAX form submit
(function(){
'use strict';
var gulp = require('gulp'),
connect = require('gulp-connect'),
open = require('gulp-open'),
rename = require('gulp-rename'),
header = require('gulp-header'),
path = require('path'),
uglify = require('gulp-uglify'),
sourcemaps = require('gulp-sourcemaps'),
jshint = require('gulp-jshint'),
stylish = require('jshint-stylish'),
paths = {
root: './',
build: 'build/',
dist: 'dist/',
demo: 'demo/',
source: 'src/',
},
e7 = {
filename: 'engine7',
pkg: require('./bower.json'),
banner: [
'/**',
' * <%= pkg.name %> <%= pkg.version %>',
' * <%= pkg.description %>',
' * ',
' * <%= pkg.homepage %>',
' * ',
' * Copyright <%= date.year %>, <%= pkg.author %>',
' * ',
' * Licensed under <%= pkg.license.join(" & ") %>',
' * ',
' * Released on: <%= date.month %> <%= date.day %>, <%= date.year %>',
' */',
''].join('\n'),
date: {
year: new Date().getFullYear(),
month: ('January February March April May June July August September October November December').split(' ')[new Date().getMonth()],
day: new Date().getDate()
}
};
gulp.task('build', function (cb) {
gulp.src(paths.source + 'engine7.js')
.pipe(sourcemaps.init())
.pipe(header(e7.banner, { pkg : e7.pkg, date: e7.date } ))
.pipe(jshint())
.pipe(jshint.reporter(stylish))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.build))
.pipe(connect.reload());
cb();
});
gulp.task('dist', function () {
gulp.src(paths.build + 'engine7.js')
.pipe(gulp.dest(paths.dist))
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(header(e7.banner, { pkg : e7.pkg, date: e7.date }))
.pipe(rename(function(path) {
path.basename = e7.filename + '.min';
}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.dist));
gulp.src(paths.build + 'engine7.js.map')
.pipe(gulp.dest(paths.dist));
});
gulp.task('watch', function () {
gulp.watch(paths.source + 'engine7.js', [ 'build' ]);
});
gulp.task('connect', function () {
return connect.server({
root: [ paths.root ],
livereload: true,
port:'3000'
});
});
gulp.task('open', function () {
return gulp.src(paths.demo + 'index.html').pipe(open({ uri: 'http://localhost:3000/' + paths.demo + 'index.html'}));
});
gulp.task('server', [ 'watch', 'connect', 'open' ]);
gulp.task('default', [ 'server' ]);
})();
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/jindlab/engine7.git
[email protected]:jindlab/engine7.git
jindlab
engine7
engine7
master

搜索帮助