-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
67 lines (62 loc) · 1.93 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
// Gulpfile.js
// Check required packages
var gulp = require('gulp');
var rename = require("gulp-rename");
// CSS compiling
var sass = require('gulp-sass');
var cleanCSS = require('gulp-clean-css');
// JS compiling
var concat = require('gulp-concat');
var minify = require('gulp-minify');
// Browsersync
var browserSync = require('browser-sync').create();
function style_ldaniel() {
return gulp.src('assets/scss/ldaniel/style.scss')
.pipe(sass().on('error', sass.logError))
.pipe(rename({ suffix: '-ldaniel' }))
.pipe(gulp.dest('assets/css/'))
.pipe(browserSync.stream())
.pipe(cleanCSS({compatibility: 'ie9', debug: true}))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('assets/css'));
}
function style_sincere() {
return gulp.src('assets/scss/sincere/style.scss')
.pipe(sass().on('error', sass.logError))
.pipe(rename({ suffix: '-sincere' }))
.pipe(gulp.dest('assets/css/'))
.pipe(browserSync.stream())
.pipe(cleanCSS({compatibility: 'ie9', debug: true}))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('assets/css'));
}
// Concatenate & minify JS
function scripts() {
return gulp.src([
'./assets/js/vendor/jquery.smooth-scroll.min.js',
'./assets/js/vendor/owl.carousel.min.js',
'./assets/js/vendor/twitterfetcher.min.js',
'./assets/js/vendor/autosize.min.js',
'./assets/js/components/*.js'
])
.pipe(concat('scripts.js'))
.pipe(minify({ ext:{
src:'.js',
min:'.min.js'
},
}))
.pipe(gulp.dest('./assets/js'));
}
function watch() {
browserSync.init({
proxy: 'http://localhost:8888/ldaniel-site',
open: false
});
gulp.watch('assets/scss/ldaniel/**/*.scss', style_ldaniel);
gulp.watch('assets/scss/sincere/**/*.scss', style_sincere);
gulp.watch('assets/js/components/*.js').on('change', browserSync.reload);
}
exports.style_ldaniel = style_ldaniel;
exports.style_sincere = style_sincere;
exports.scripts = scripts;
exports.default = watch;