-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
108 lines (61 loc) · 2.04 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
var gulp = require("gulp"),
sass = require("gulp-sass"),
browserSync = require('browser-sync'),
fs = require("fs"),
uglify = require("gulp-uglify"),
obfuscate = require("gulp-obfuscate");
gulp.task("browserSync", function(){
browserSync(
{
server: {
baseDir: 'app'
},
host: "192.168.1.197"
}
);
});
gulp.task( "sass", function(){
return gulp.src('app/sass/**/*.sass')
.pipe(sass())
.pipe(gulp.dest('app/css'))
.pipe(browserSync.reload({stream: true}));
});
gulp.task("watch", ["browserSync", "sass"], function(){
gulp.watch('app/sass/**/*.sass',['sass']);
gulp.watch('app/*.html', browserSync.reload);
gulp.watch('app/js/**/*.js', browserSync.reload);
gulp.watch('app/css/**/*.css', browserSync.reload );
}
);
gulp.task("build", function(){
var html = gulp.src("app/*.html").pipe(gulp.dest("dist"));
var js = gulp.src("app/js/**/*.js").pipe(uglify()).pipe(gulp.dest("dist/js"));
var img = gulp.src("app/img/**/*.*").pipe(gulp.dest("dist/img"));
var css = gulp.src("app/css/**/*.css").pipe(gulp.dest("dist/css"));
var fonts = gulp.src("app/fonts/**/*.*").pipe(gulp.dest("dist/fonts"));
var libs = gulp.src("app/libs/**/*.*").pipe(gulp.dest("dist/libs"));
} );
gulp.task("uglify", function(){
return gulp.src("app/js/*.js").
pipe(uglify()).
pipe(gulp.dest("app/js2"));
} );
gulp.task('dirs', ['dirs2'], function () {
fs.writeFileSync("app/index.html","");
});
gulp.task('dirs2', function () {
return gulp.src('*.*', {read: false})
.pipe(gulp.dest('app/css'))
.pipe(gulp.dest('app/sass'))
.pipe(gulp.dest('app/img'))
.pipe(gulp.dest('app/js'))
.pipe(gulp.dest('app/libs'))
.pipe(gulp.dest('app/fonts'))
.pipe(gulp.dest('dist'));
});
gulp.task("readDir", function(){
var imgFiles = fs.readdirSync("C:/temp/files/");
console.log(imgFiles[0]);
fs.writeFileSync("C:/temp/1.txt",imgFiles.join("\"\,\""));
});
gulp.task("default", ["watch"]);