Skip to content

Commit a73758c

Browse files
committed
初始化版本
0 parents  commit a73758c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+15283
-0
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dist
2+
dist/*
3+
node_modules
4+
node_modules/**
5+
.idea
6+
.git/

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# ibrand-wechat
2+
ibrand小程序

gulpfile.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
var gulp = require('gulp')
2+
var minifycss = require('gulp-minify-css')
3+
var less = require('gulp-less')
4+
var path = require('path')
5+
var fs = require('fs')
6+
var changed = require('gulp-changed');
7+
var notify = require('gulp-notify');
8+
var merge = require('merge-stream')
9+
var plumber = require('gulp-plumber')
10+
var rename = require('gulp-rename')
11+
var yargs = require('yargs')
12+
var DIST = 'src/pages'
13+
14+
function getFile(type){
15+
if (typeof type !== 'string') return;
16+
var filePath = fs.readdirSync(path.resolve('./src/pages'))
17+
var fileArr = []
18+
filePath.forEach(function(item){
19+
var pagePath = path.join('./src/pages',item)
20+
var pageFiles = fs.readdirSync(pagePath)
21+
22+
pageFiles.forEach(function(v) {
23+
var lastPath = path.join(pagePath,v,v + '.'+ type)
24+
25+
fileArr.push(lastPath.split('\\').join('/'))
26+
})
27+
})
28+
29+
return fileArr
30+
}
31+
32+
33+
var files = getFile('less');
34+
35+
36+
gulp.task('less', function () {
37+
38+
39+
var tasks = files.map(function(item){
40+
41+
return gulp.src('./'+ item)
42+
43+
.pipe(changed(DIST))
44+
.pipe(less())
45+
.pipe(gulp.dest(path.join(item,'..')))
46+
.pipe(minifycss())
47+
.pipe(gulp.dest(path.join(item,'..')))
48+
49+
50+
})
51+
52+
return merge(...tasks)
53+
54+
})
55+
56+
57+
58+
gulp.task('changeFileName',['less'],function(){
59+
var files = getFile('css')
60+
var tasks = files.map(function(v){
61+
return gulp.src(v)
62+
.pipe(changed(DIST))
63+
.pipe(rename(function(path){
64+
path.extname = ".wxss"
65+
}))
66+
.pipe(gulp.dest(path.join(v,'..')))
67+
})
68+
69+
70+
return merge(...tasks)
71+
})
72+
73+
74+
75+
gulp.watch('src/pages/**/**/*.less',['less','changeFileName'])
76+
77+
gulp.task('default',['less','changeFileName']);
78+

0 commit comments

Comments
 (0)