generator-onekey-h5
Advanced tools
Comparing version 0.0.2 to 0.0.4
@@ -5,2 +5,3 @@ // 导入文件结构配置 | ||
var version = '-v1.0'; | ||
//导入依赖 | ||
@@ -15,2 +16,4 @@ var gulp = require('gulp'), | ||
imagemin = require('gulp-imagemin'), //图片压缩 | ||
imageminGifsicle = require('imagemin-gifsicle'), | ||
cache = require('gulp-cache'), //cache | ||
uglify = require('gulp-uglify'), //压缩js | ||
@@ -32,3 +35,3 @@ babel = require('gulp-babel'), //es6 | ||
gulp.task('clean', function() { | ||
gulp.task('clean', function () { | ||
return gulp.src(dir.dev.root, { | ||
@@ -39,4 +42,4 @@ read: false | ||
}); | ||
gulp.task('cleanall', function() { | ||
return gulp.src([dir.dev.root, dir.public.root], { | ||
gulp.task('cleanall', function () { | ||
return gulp.src([dir.dev.root, dir.public.root, dir.temp.root], { | ||
read: false | ||
@@ -50,7 +53,14 @@ }) | ||
gulp.task('acss', function() { | ||
gulp.task('acss', function () { | ||
return gulp.src(dir.src.css) | ||
.pipe(sourcemaps.init()) | ||
.pipe(sass()) | ||
.pipe(sourcemaps.write('./map/')) | ||
.pipe(autoprefixer({ //添加前缀 | ||
browsers: ['last 2 versions'], | ||
cascade: false | ||
})) | ||
.pipe(order([ | ||
'reset.css', | ||
'**.css' | ||
])) | ||
.pipe(concat('all' + version + '.css')) | ||
.pipe(gulp.dest(dir.dev.css)) | ||
@@ -60,3 +70,3 @@ .pipe(connect.reload()); | ||
gulp.task('bcss', function() { | ||
gulp.task('bcss', function () { | ||
util.log('autofixer and minify css'); | ||
@@ -70,16 +80,29 @@ return gulp.src(dir.src.css) | ||
.pipe(order([ | ||
'index.css', | ||
'mobiscroll_002.css', | ||
'mobiscroll_001.css', | ||
'mobiscroll_003.css', | ||
'reset.css', | ||
'**.css' | ||
])) | ||
.pipe(concat('all.css')) | ||
.pipe(concat('all' + version + '.css')) | ||
.pipe(cleanCSS()) | ||
.pipe(gulp.dest(dir.temp.css)); | ||
}); | ||
gulp.task('ccss', function () { | ||
util.log('autofixer and minify css'); | ||
return gulp.src(dir.src.css) | ||
.pipe(sass()) | ||
.pipe(autoprefixer({ //添加前缀 | ||
browsers: ['last 2 versions'], | ||
cascade: false | ||
})) | ||
.pipe(order([ | ||
'reset.css', | ||
'**.css' | ||
])) | ||
.pipe(concat('all' + version + '.css')) | ||
.pipe(cleanCSS()) | ||
.pipe(gulp.dest(dir.public.css)); | ||
}); | ||
//处理js | ||
gulp.task('ajs', function() { | ||
gulp.task('ajs', function () { | ||
return gulp.src(dir.src.js + '*.js') | ||
@@ -94,3 +117,3 @@ .pipe(babel({ | ||
])) | ||
.pipe(concat('all.js')) | ||
.pipe(concat('all' + version + '.js')) | ||
.pipe(gulp.dest(dir.dev.js)) | ||
@@ -100,3 +123,3 @@ .pipe(connect.reload()); | ||
gulp.task('bjs', function() { | ||
gulp.task('bjs', function () { | ||
return gulp.src(dir.src.js + '*.js') | ||
@@ -111,3 +134,3 @@ .pipe(babel({ | ||
])) | ||
.pipe(concat('all.js')) | ||
.pipe(concat('all' + version + '.js')) | ||
.pipe(uglify()) | ||
@@ -118,5 +141,21 @@ .pipe(gulp.dest(dir.temp.js)) | ||
}); | ||
gulp.task('cjs', function () { | ||
return gulp.src(dir.src.js + '*.js') | ||
.pipe(babel({ | ||
presets: ['es2015'] | ||
})) | ||
.pipe(order([ | ||
'jquery.min.js', | ||
'jquery.**.js', | ||
'**.js' | ||
])) | ||
.pipe(concat('all' + version + '.js')) | ||
.pipe(uglify()) | ||
.pipe(gulp.dest(dir.public.js)) | ||
.pipe(connect.reload()); | ||
}); | ||
//校验js | ||
gulp.task('lint', function() { | ||
gulp.task('lint', function () { | ||
return gulp.src(dir.src.js + '/*.js') | ||
@@ -131,3 +170,3 @@ .pipe(jshint({ | ||
gulp.task('aimg', function() { | ||
gulp.task('aimg', function () { | ||
return gulp.src(dir.src.image) | ||
@@ -139,3 +178,3 @@ .pipe(clone()) | ||
gulp.task('bimg', function() { | ||
gulp.task('bimg', function () { | ||
return gulp.src(dir.src.image) | ||
@@ -147,3 +186,3 @@ .pipe(imagemin()) | ||
//移动静态资源 | ||
gulp.task('clonefont', function() { | ||
gulp.task('clonefont', function () { | ||
return gulp.src(dir.src.font + '**') | ||
@@ -156,3 +195,3 @@ .pipe(clone()) | ||
gulp.task('clonestatic', function() { | ||
gulp.task('clonestatic', function () { | ||
return gulp.src(dir.src.static + '**') | ||
@@ -164,3 +203,3 @@ .pipe(clone()) | ||
}); | ||
gulp.task('clone', ['clonefont', 'clonestatic'], function() { | ||
gulp.task('clone', ['clonefont', 'clonestatic'], function () { | ||
util.log('clone done'); | ||
@@ -170,3 +209,3 @@ }); | ||
//html | ||
gulp.task('ahtml', function() { | ||
gulp.task('ahtml', function () { | ||
gulp.src(dir.src.html) | ||
@@ -200,31 +239,35 @@ .pipe(clone()) | ||
gulp.task('dev', ['acss', 'ajs', 'aimg', 'clone', 'ahtml'], function() { | ||
gulp.task('dev', ['acss', 'ajs', 'aimg', 'clone', 'ahtml'], function () { | ||
util.log('------success dev------'); | ||
}); | ||
gulp.task('build', ['bimg', 'revreplace', 'clone'], function() { | ||
gulp.task('build', ["ccss", "cjs", 'bimg', 'clone', 'ahtml'], function () { | ||
util.log('------success build------'); | ||
}); | ||
gulp.task('build-hash', ['revreplace', 'bimg', 'clone'], function () { | ||
util.log('------success build------'); | ||
}); | ||
//监视器 | ||
gulp.task('watchdev', ['dev'], function() { | ||
gulp.task('watchdev', ['dev'], function () { | ||
gulp.watch(dir.src.css, ['acss']) | ||
.on('change', function(event) { | ||
.on('change', function (event) { | ||
console.log('css-- ' + event.path + ' was ' + event.type + ', running tasks acss'); | ||
}); | ||
gulp.watch(dir.src.js, ['ajs']) | ||
.on('change', function(event) { | ||
.on('change', function (event) { | ||
console.log('js--- ' + event.path + ' was ' + event.type + ', running tasks ajs'); | ||
}); | ||
gulp.watch(dir.src.image, ['aimg']) | ||
.on('change', function(event) { | ||
.on('change', function (event) { | ||
console.log('images--- ' + event.path + ' was ' + event.type + ', running tasks aimg'); | ||
}); | ||
gulp.watch(dir.src.static, ['clone']) | ||
.on('change', function(event) { | ||
.on('change', function (event) { | ||
console.log('static\'s file--- ' + event.path + ' was ' + event.type + ', running tasks clone'); | ||
}); | ||
gulp.watch(dir.src.html, ['ahtml']) | ||
.on('change', function(event) { | ||
.on('change', function (event) { | ||
console.log('html--- ' + event.path + ' was ' + event.type + ', running tasks ahtml'); | ||
@@ -236,3 +279,3 @@ }); | ||
gulp.task('serverDev', function() { | ||
gulp.task('serverDev', function () { | ||
util.log('Start processing'); | ||
@@ -246,3 +289,3 @@ connect.server({ | ||
}); | ||
gulp.task('serverPublic', function() { | ||
gulp.task('serverPublic', function () { | ||
util.log('Start processing'); | ||
@@ -249,0 +292,0 @@ connect.server({ |
{ | ||
"name": "test", | ||
"version": "1.0.0", | ||
"name": "active-build-factory", | ||
"version": "1.0.2", | ||
"description": "onekey h5 pages", | ||
@@ -11,2 +11,3 @@ "main": "gulpfile.js", | ||
"gulp-babel": "^6.1.2", | ||
"gulp-cache": "^0.4.6", | ||
"gulp-clean": "^0.3.2", | ||
@@ -42,3 +43,6 @@ "gulp-clean-css": "^2.3.2", | ||
"license": "ISC", | ||
"keywords":["shareit"] | ||
"keywords": [ | ||
"shareit", | ||
"webkong" | ||
] | ||
} |
{ | ||
"name": "generator-onekey-h5", | ||
"version": "0.0.2", | ||
"version": "0.0.4", | ||
"description": "Used to one key generation H5 activity page the scaffolding of the project", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/webkong/generator-onekey-h5#readme", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14330
321