-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.babel.js
62 lines (56 loc) · 1.34 KB
/
gulpfile.babel.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
const gulp = require('gulp');
const livereload = require('gulp-livereload');
const connect = require('gulp-connect');
const sass = require('gulp-sass');
const concat = require('gulp-concat');
const cssmin = require('gulp-cssmin');
const rename = require('gulp-rename');
const Tasks = Object.freeze({
BUILD: 'build',
SCRIPTS: 'scripts',
STYLES: 'styles',
DEFAULT: 'default',
WATCH: 'watch',
CONNECT: 'connect'
});
const Paths = Object.freeze({
DIST: './dist',
DIST_MAIN: '.',
SCRIPTS: './assets/scripts/**/*.js',
STYLES: ['./src/styles/*.scss', './src/styles/**/*.scss'],
STYLE_DIST: '/src/phoenix-toolkit.css',
MAIN_STYLE_FILE: './src/styles/main.scss',
INDEX: './index.html'
});
gulp.task(Tasks.STYLES, function() {
return gulp.src(Paths.MAIN_STYLE_FILE)
.pipe(sass())
.pipe(concat(Paths.STYLE_DIST))
.pipe(gulp.dest(Paths.DIST))
.pipe(cssmin())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(Paths.DIST));
});
gulp.task(Tasks.WATCH, function () {
livereload.listen();
gulp.watch(
[
Paths.STYLES,
Paths.MAIN_STYLE_FILE,
Paths.INDEX
],[
Tasks.STYLES
]
);
});
gulp.task(Tasks.CONNECT, function() {
connect.server({
root: '.',
port: 8884
});
});
gulp.task(Tasks.DEFAULT, [
Tasks.CONNECT,
Tasks.STYLES,
Tasks.WATCH
]);