-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
79 lines (66 loc) · 2.36 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
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var autoprefixer = require('gulp-autoprefixer');
var minifycss = require('gulp-minify-css');
var resolveDependencies = require('gulp-resolve-dependencies');
var source_folder = 'source/assets/';
var build_folder = 'assets/';
// Compile Our Sass
gulp.task('sass', function() {
// backend
gulp.src(source_folder + 'scss/admin/admin.scss')
.pipe(sass())
.pipe(autoprefixer('last 2 version', 'Explorer 8'))
.pipe(gulp.dest(build_folder + 'css'))
.pipe(rename('admin.min.css'))
.pipe(minifycss({keepSpecialComments: 0}))
.pipe(gulp.dest(build_folder + 'css'));
// fontend
return gulp.src(source_folder + 'scss/main.scss')
.pipe(sass())
.pipe(autoprefixer('last 2 version', 'Explorer 8'))
.pipe(gulp.dest(build_folder + 'css'))
.pipe(rename('main.min.css'))
.pipe(minifycss({keepSpecialComments: 0}))
.pipe(gulp.dest(build_folder + 'css'));
});
// Concatenate & Minify JS
gulp.task('scripts', function() {
gulp.src(source_folder + 'js/jquery.js')
.pipe(resolveDependencies({
pattern: /\* @requires [\s-]*(.*?\.js)/g,
log: true
}))
.pipe(concat('jquery.js'))
.pipe(gulp.dest(build_folder + 'js'))
.pipe(rename('jquery.min.js'))
.pipe(uglify())
.pipe(gulp.dest(build_folder + 'js'));
return gulp.src(source_folder + 'js/main.js')
.pipe(resolveDependencies({
pattern: /\* @requires [\s-]*(.*?\.js)/g,
log: true
}))
.pipe(concat('main.js'))
.pipe(gulp.dest(build_folder + 'js'))
.pipe(rename('main.min.js'))
.pipe(uglify())
.pipe(gulp.dest(build_folder + 'js'));
});
// Copy Files
gulp.task('move-assets', function() {
return gulp.src(source_folder + 'img/*')
.pipe(gulp.dest(build_folder + 'img'));
});
// Watch Files For Changes
gulp.task('watch', function() {
//gulp.watch(source_folder + 'js/{,**/}*.js', ['lint', 'scripts']);
gulp.watch(source_folder + 'scss/{,**/}*.scss', ['sass']);
});
// Default Task
gulp.task('default', ['sass', 'move-assets', 'scripts']);