This repository has been archived by the owner on Jan 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
110 lines (92 loc) · 2.85 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
109
110
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var less = require('gulp-less');
var minify_html = require('gulp-minify-html');
var minify_css = require('gulp-minify-css');
var del = require('del');
var es = require('event-stream');
var run_sequence = require('run-sequence');
var zip = require('gulp-zip');
var debug = require('gulp-debug');
//var concat = require('gulp-concat');
/***********************/
var OUTPUT_PATH = 'dist/';
/***********************/
gulp.task('misc', function(){
return gulp.src( ['manifest.json',
'LICENSE'] )
.pipe(gulp.dest(OUTPUT_PATH));
});
/***********************/
gulp.task('vendor', function() {
return gulp.src(
['vendor/google/material-design-lite.js'])
.pipe(uglify()).on('error', errorHandler)
.pipe(gulp.dest(OUTPUT_PATH + "vendor/google/"));
});
/***********************/
gulp.task('bower', function(){
return gulp.src(
['bower_components/micromustache/dist/**/*.min.js',
'bower_components/zepto/zepto.min.js']
, {base: './bower_components'})
.pipe(uglify())
.pipe(gulp.dest(OUTPUT_PATH + "bower_components"));
});
/***********************/
gulp.task('css', function(){
var css_from_less = gulp.src('app/assets/*.less')
.pipe(less());
var css = gulp.src('app/assets/*.css');
return es.merge(css_from_less, css)
.pipe(minify_css())
.pipe(gulp.dest(OUTPUT_PATH + 'app/assets/'));
});
/***********************/
gulp.task('images', function(){
return gulp.src('app/assets/*.png')
.pipe(gulp.dest(OUTPUT_PATH+"app/assets/"));
});
/***********************/
gulp.task('scripts', /*['dep'],*/function() {
return gulp.src('app/**/*.js')
//.pipe(concat())
.pipe(uglify()).on('error', errorHandler)
.pipe(gulp.dest(OUTPUT_PATH + 'app'));
});
/***********************/
gulp.task('html', /*['dep'],*/function() {
return gulp.src('app/**/*.html', {base: './app'})
.pipe(minify_html()).on('error', errorHandler)
.pipe(gulp.dest(OUTPUT_PATH + 'app'));
});
/***********************/
gulp.task('scripts', /*['dep'],*/function() {
return gulp.src('app/**/*.js')
//.pipe(concat())
.pipe(uglify()).on('error', errorHandler)
.pipe(gulp.dest(OUTPUT_PATH + 'app'));
});
/***********************/
gulp.task('pack', function() {
console.log("Creating BUILD.ZIP...");
console.log("https://chrome.google.com/webstore/developer/dashboard");
return gulp.src(OUTPUT_PATH + "**/*")
.pipe(zip('build.zip'))
.pipe(gulp.dest('.'));
});
/***********************/
gulp.task('clean', function(callback) {
del(['build.zip']);
return del(['dist'], callback);
});
/***********************/
gulp.task('build', ['misc', 'css', 'images', 'vendor', 'bower', 'html', 'scripts']);
/***********************/
gulp.task('default', function(callback){
return run_sequence('clean', ['build'], 'pack', callback);
});
function errorHandler(error) {
console.log(error.toString());
this.emit('end');
}