-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
125 lines (109 loc) · 4.34 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
var gulp = require('gulp'),
concatCss = require('gulp-concat-css'),
jshint = require('gulp-jshint'),
cleanCSS = require('gulp-clean-css'),
concat = require('gulp-concat'),
htmlmin = require('gulp-htmlmin'),
uglify = require("gulp-uglify"),
rename = require("gulp-rename"),
ngmin = require('gulp-ngmin'),
browserSync = require('browser-sync');
gulp.task('default', function() {
console.log( "\n Restaurant Reviewer - Gulp Command List \n" );
console.log( "-------------------------------------------\n" );
console.log( "gulp serve - start serve on port 3000." );
console.log( "gulp test - test dist folder application." );
console.log( "gulp build - build dist folder\n" );
console.log( "-------------------------------------------\n" );
});
gulp.task('serve', function() {
browserSync.init({
server: {
baseDir: ["app"],
index: "index.html",
routes: {
"/bower_components": "bower_components",
"/node_modules": "node_modules"
}
},
browser: "google chrome canary"
});
console.log('## server started ##');
gulp.watch('app/**/*').on('change', browserSync.reload);
gulp.watch('app/**/*.js').on('change', function(event) {
console.log("Linting " + event.path);
gulp.src(event.path)
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});
});
gulp.task('test', function() {
browserSync.init({
server: {
baseDir: ["dist"],
index: "index.html"
}
});
console.log('## production server started ##');
});
gulp.task('minify-css', function() {
return gulp.src(['bower_components/normalize-css/normalize.css',
'bower_components/angular-material/angular-material.min.css',
'bower_components/bootstrap/dist/css/bootstrap.min.css',
'bower_components/animate.css/animate.css',
'bower_components/font-awesome/css/font-awesome.min.css',
'bower_components/angular-ui-select/dist/select.min.css',
'app/styles/main.css',
'app/styles/layout.css',
'app/styles/spin-loader.css'])
.pipe(concatCss('styles-1.0.7.min.css'))
.pipe(cleanCSS({ keepSpecialComments: 1, processImport: false }))
.pipe(gulp.dest('dist/css'));
});
gulp.task('compress', function() {
return gulp.src(['bower_components/jquery/dist/jquery.js',
'bower_components/angular/angular.js',
'bower_components/angular-animate/angular-animate.js',
'bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
'bower_components/bootstrap/dist/js/bootstrap.min.js',
'bower_components/angular-ui-router/release/angular-ui-router.js',
'bower_components/angular-ui-select/dist/select.min.js',
'bower_components/angular-material/angular-material.min.js',
'bower_components/angular-aria/angular-aria.min.js',
'bower_components/angular-md5/angular-md5.min.js',
'app/app.js',
'app/app.routes.js',
'app/app.config.js',
'app/js/controllers/*.js',
'app/js/directives/*.js',
'app/js/services/*.js'])
.pipe(concat('scripts-1.0.7.js'))
.pipe(ngmin())
.pipe(gulp.dest('dist/js'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify({mangle: false}))
.pipe(gulp.dest('dist/js'));
});
gulp.task('minify-js', function () {
gulp.src('./JavaScript/*.js') // path to your files
.pipe(uglify())
.pipe(gulp.dest('path/to/destination'));
});
gulp.task('pages', function() {
gulp.src(['app/views/**/*'])
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest('dist/views'));
});
gulp.task('images', function() {
gulp.src(['app/images/**/*'])
.pipe(gulp.dest('dist/images'));
});
gulp.task('bootstrap', function() {
gulp.src(['bower_components/bootstrap/dist/fonts/**/*'])
.pipe(gulp.dest('dist/bootstrap/dist/fonts'));
});
gulp.task('fonts', function() {
gulp.src(['bower_components/font-awesome/fonts/**/*'])
.pipe(gulp.dest('dist/font-awesome/fonts'));
});
gulp.task('build', ['minify-css', 'compress', 'pages', 'images', 'bootstrap', 'fonts']);