forked from MRebati/AdminPanel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
105 lines (92 loc) · 2.75 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
var gulp = require('gulp'),
gutil = require('gulp-util'),
browserify = require('gulp-browserify'),
stylish = require('jshint-stylish'),
jshint = require('gulp-jshint'),
w3cjs = require('gulp-w3cjs'),
compass = require('gulp-compass'),
connect = require('gulp-connect'),
gulpif = require('gulp-if'),
uglify = require('gulp-uglify'),
minifyHTML = require('gulp-minify-html'),
concat = require('gulp-concat'),
path = require('path');
var env,
jsSources,
sassSources,
htmlSources,
outputDir,
sassStyle;
env = 'development';
if (env==='development') {
outputDir = 'builds/Development/';
sassStyle = 'expanded';
} else {
outputDir = 'builds/Production/';
sassStyle = 'compressed';
}
jsSources = [
'components/scripts/jqloader.js',
'components/scripts/jquery-ui.js',
'components/scripts/bootstrap.min.js',
'components/scripts/TweenMax.min.js',
'components/scripts/jquery.scrollmagic.min.js',
'components/scripts/script.js',
'components/scripts/jquery.nicescroll.min.js'
];
sassSources = ['components/sass/style.scss'];
htmlSources = [outputDir + '*.html'];
gulp.task('js', function() {
'use strict';
gulp.src('components/scripts/script.js')
.pipe(jshint('./.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'));
gulp.src(jsSources)
.pipe(concat('script.js'))
.pipe(browserify())
.on('error', gutil.log)
.pipe(gulpif(env === 'production', uglify()))
.pipe(gulp.dest(outputDir + '/Scripts'))
.pipe(connect.reload());
});
gulp.task('compass', function() {
'use strict';
gulp.src(sassSources)
.pipe(compass({
sass: 'components/sass',
css: outputDir + 'Content/dist/css',
image: outputDir + 'Content/dist/images',
style: sassStyle,
require: ['susy', 'breakpoint']
})
.on('error', gutil.log))
// .pipe(gulp.dest( outputDir + 'css'))
.pipe(connect.reload());
});
gulp.task('watch', function() {
'use strict';
gulp.watch(jsSources, ['js']);
gulp.watch(['components/sass/*.scss', 'components/sass/*/*.scss'], ['compass']);
gulp.watch('builds/development/*.html', ['html']);
});
gulp.task('connect', function() {
'use strict';
connect.server({
root: outputDir,
livereload: true
});
});
gulp.task('html', function() {
'use strict';
gulp.src('builds/development/*.html')
.pipe(gulpif(env === 'production', minifyHTML()))
.pipe(gulpif(env === 'production', gulp.dest(outputDir)))
.pipe(connect.reload());
});
// Copy images to production
gulp.task('move', function() {
'use strict';
gulp.src('builds/development/Content/dist/images/*.*')
.pipe(gulpif(env === 'production', gulp.dest(outputDir+'Content/dist/images')));
});
gulp.task('default', ['watch', 'html', 'js', 'compass', 'move', 'connect']);