-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
executable file
·106 lines (94 loc) · 3.13 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
'use strict';
const gulp = require('gulp');
const sass = require('gulp-sass');
const cleanCSS = require('gulp-clean-css');
const rename = require('gulp-rename');
const browserSync = require('browser-sync').create();
const npmDist = require('gulp-npm-dist');
const sourcemaps = require('gulp-sourcemaps');
gulp.task('sass-css', function() {
return gulp.src(['scss/custom.scss', 'scss/dashforge.scss'])
.pipe(sass())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('assets/css'))
.pipe(browserSync.reload({
stream: true
}))
});
gulp.task('minify-css', function() {
return gulp.src(['scss/custom.scss', 'scss/dashforge.scss'])
.pipe(sass({ outputStyle: 'compressed' }))
.pipe(rename({ suffix: '.min' }))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('assets/css'))
.pipe(browserSync.reload({
stream: true
}))
});
// styles for pages
gulp.task('sass-pages', function() {
return gulp.src('scss/pages/*.scss')
.pipe(sass())
.pipe(rename({ prefix: 'dashforge.' }))
.pipe(gulp.dest('assets/css'))
.pipe(browserSync.reload({
stream: true
}))
});
// styles for skins
gulp.task('sass-skins', function() {
return gulp.src('scss/skins/*.scss')
.pipe(sass())
.pipe(rename({ prefix: 'skin.' }))
.pipe(gulp.dest('assets/css'))
.pipe(browserSync.reload({
stream: true
}))
});
gulp.task('browserSync', function() {
browserSync.init({
// server: true
proxy: 'localhost:8888/monatro'
})
});
gulp.task('default', ['browserSync'], function() {
gulp.watch([
'scss/custom.scss'
], ['sass-css', 'minify-css']);
gulp.watch('scss/pages/*.scss', ['sass-pages', 'minify-css']);
gulp.watch('scss/skins/*.scss', ['sass-skins', 'minify-css']);
gulp.watch([
'scss/_variables.scss',
'scss/bootstrap/_variables.scss'
], ['sass-css', 'sass-pages']);
gulp.watch('*.php', browserSync.reload);
gulp.watch('lib/**/*.js', browserSync.reload);
gulp.watch('template/**/*.html', browserSync.reload);
gulp.watch('components/**/*.html', browserSync.reload);
gulp.watch('collections/**/*.html', browserSync.reload);
gulp.watch('assets/js/*.js', browserSync.reload);
})
// Copy dependencies to lib/
gulp.task('npm-lib', function() {
gulp.src(npmDist(), { base: './node_modules/' })
.pipe(rename(function(path) {
path.dirname = path.dirname.replace(/\/dist/, '').replace(/\\dist/, '');
}))
.pipe(gulp.dest('lib'));
});
//copy html
gulp.task('html:dist', function() {
return gulp.src(['*.html', '*.php'])
.pipe(gulp.dest('dist/'));
});
gulp.task('assets:dist', function() {
return gulp.src(['assets/**/*'])
.pipe(gulp.dest('dist/assets'));
});
gulp.task('lib:dist', function() {
return gulp.src(['lib/**/*'])
.pipe(gulp.dest('dist/lib'));
});
gulp.task('build', ['assets:dist', 'html:dist', 'lib:dist'], function() {
return true;
})