-
Notifications
You must be signed in to change notification settings - Fork 25
/
gulpfile.js
100 lines (83 loc) · 3.73 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
var gulp = require('gulp');
var del = require('del');
var fs = require('fs-plus');
var replace = require('gulp-replace');
var zip = require('gulp-zip');
gulp.task('clean', function(cb) {
del(['dist'], cb);
});
gulp.task('scripts', ['clean'], function() {
return gulp.src("client-src/js/**/*.js")
.pipe(gulp.dest('dist/build/js'));
});
gulp.task('templates', ['clean'], function() {
return gulp.src("client-src/templates/**/*.html")
.pipe(gulp.dest('dist/build/templates'));
});
gulp.task('images', ['clean'], function() {
return gulp.src("client-src/images/**/*")
.pipe(gulp.dest('dist/build/images'));
});
gulp.task('styles', ['clean'], function() {
return gulp.src("client-src/css/**/*")
.pipe(gulp.dest('dist/build/css'));
});
gulp.task('frameworks',['clean'],function() {
fs.copySync(__dirname+"/client-src/frameworks/SketchConsole/Build/Products/Release/SketchConsole.framework",__dirname+"/dist/build/SketchConsole.framework");
});
gulp.task('plugin', ['clean'], function() {
return gulp.src([
"client-src/*.sketchplugin",
"client-src/consoleOptions.json"
])
.pipe(replace("/frameworks/SketchConsole/Build/Products/Release", ""))
.pipe(gulp.dest('dist/build'));
});
gulp.task('changelog', ['clean'], function() {
return gulp.src([
"client-src/data/changelog.json"
]).pipe(gulp.dest('dist/build/data'));
});
gulp.task('componentsCSS', ['clean'], function() {
return gulp.src([
"client-src/bower_components/bootstrap/dist/css/bootstrap.css",
"client-src/bower_components/bootstrap/dist/css/bootstrap.css.map"
]).pipe(gulp.dest('dist/build/css'));
});
gulp.task('fontAwesome', ['clean'], function() {
gulp.src("client-src/bower_components/fontawesome/css/*").pipe(gulp.dest('dist/build/css/fontawesome/css'));
gulp.src("client-src/bower_components/fontawesome/fonts/*").pipe(gulp.dest('dist/build/css/fontawesome/fonts'));
});
gulp.task('componentsJS', ['clean'], function() {
return gulp.src([
"client-src/bower_components/jquery/dist/jquery.js",
"client-src/bower_components/angular/angular.js",
"client-src/bower_components/angular-bootstrap/ui-bootstrap-tpls.js",
"client-src/bower_components/moment/moment.js",
"client-src/bower_components/underscore/underscore.js",
"client-src/bower_components/mustache/mustache.js",
"client-src/bower_components/keyboardjs/keyboardjs.js",
"client-src/bower_components/markdown/lib/markdown.js"
]).pipe(gulp.dest('dist/build/js'));
});
gulp.task('index', ['clean'], function() {
gulp.src(['client-src/index.html'])
.pipe(replace("./bower_components/bootstrap/dist/css/", "./css/"))
.pipe(replace("./bower_components/fontawesome/css/", "./css/fontawesome/css/"))
.pipe(replace("./bower_components/jquery/dist/", "./js/"))
.pipe(replace("./bower_components/angular/", "./js/"))
.pipe(replace("./bower_components/angular-bootstrap/", "./js/"))
.pipe(replace("./bower_components/moment/", "./js/"))
.pipe(replace("./bower_components/underscore/", "./js/"))
.pipe(replace("./bower_components/mustache/", "./js/"))
.pipe(replace("./bower_components/keyboardjs/", "./js/"))
.pipe(replace("./bower_components/markdown/lib", "./js/"))
.pipe(replace("?ts=NO_CACHE","?ts="+(new Date().valueOf()).toString()))
.pipe(gulp.dest('dist/build'));
});
gulp.task('zip',['frameworks','scripts','templates','styles','plugin','images','componentsCSS','componentsJS','index','fontAwesome','changelog'],function() {
return gulp.src('dist/build/**/*')
.pipe(zip('Sketch DevTools.zip'))
.pipe(gulp.dest('dist'));
});
gulp.task('default', ['zip']);