-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
73 lines (59 loc) · 2.06 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
const del = require('del');
const gulp = require('gulp');
const glps = require('gulp-load-plugins');
const runs = require('run-sequence');
const merge = require('merge-stream');
const $ = glps();
gulp.task('dist', (done) => runs('clear', ['css', 'scss', 'js', 'fonts'], done));
gulp.task('dev', (done) => runs('watch', 'serve', done));
gulp.task('serve', () => {
gulp
.src('.')
.pipe($.webserver({
open: true,
port: 8000,
host: 'localhost',
livereload: 34567
}));
});
gulp.task('watch', () => {
gulp.watch('src/**/*', ['dist']);
});
gulp.task('clear', () => {
return del(['dist'], {force: true});
});
gulp.task('css', () => {
return gulp.src('src/stylesheets/mumuki-styles.scss')
.pipe($.sass())
.pipe($.concat('mumuki-styles.css'))
.pipe(gulp.dest('dist/css'));
});
gulp.task('scss', ['scss:vendor'], () => {
return gulp.src('src/stylesheets/**/*.scss')
.pipe($.replace('@import "../../node_modules/bootstrap/scss', '@import "vendor/bootstrap/'))
.pipe($.replace('@import "../../node_modules/dev-awesome/', '@import "vendor/dev-awesome/'))
.pipe($.replace('@import "../../node_modules/@fortawesome/', '@import "vendor/'))
.pipe(gulp.dest('dist/scss'));
});
gulp.task('scss:vendor', () => {
const fontawesome = gulp.src('node_modules/@fortawesome/**/*.scss')
.pipe(gulp.dest('dist/scss/vendor'));
const bootstrap = gulp.src('node_modules/bootstrap/scss/**/*.scss')
.pipe(gulp.dest('dist/scss/vendor/bootstrap'));
const devawesome = gulp.src('node_modules/dev-awesome/**/*.scss')
.pipe(gulp.dest('dist/scss/vendor/dev-awesome'));
return merge(fontawesome, bootstrap, devawesome);
});
gulp.task('js', () => {
return gulp.src(require('./src/assets.js').concat(require('./src/javascripts')))
.pipe($.concat('mumuki-styles.js'))
.pipe(gulp.dest('dist/javascripts'));
});
gulp.task('fonts', () => {
const fonts = [
'node_modules/@fortawesome/fontawesome-free/webfonts/*',
'node_modules/dev-awesome/dist/fonts/**/*',
];
return gulp.src(fonts)
.pipe(gulp.dest('dist/fonts'));
});