-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
49 lines (44 loc) · 1004 Bytes
/
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
const gulp = require('gulp');
const autoprefixer = require('gulp-autoprefixer');
const sass = require('gulp-sass');
const exec = require('gulp-exec');
const clean = require('gulp-clean');
const sequence = require('gulp-sequence');
const cleanCSS = require('gulp-clean-css');
gulp.task('default',
sequence(
'clean',
'css',
'public',
'elm'
));
/*
* Clean up existing dist
*/
gulp.task('clean', () =>
gulp.src('dist', {read: false})
.pipe(clean()));
/*
* Compile Sass to CSS and autoprefix it
*/
gulp.task('css', () =>
gulp.src('src/ui.sass')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
}))
.pipe(cleanCSS())
.pipe(gulp.dest('dist/css')));
/*
* Copy files to dist
*/
gulp.task('public', () =>
gulp.src('public/**/*')
.pipe(gulp.dest('dist')));
/*
* Compile elm files
*/
gulp.task('elm', () =>
gulp.src('./elm-package.json')
.pipe(exec('elm make src/Main.elm --output dist/js/elm.js'))
.pipe(exec.reporter()));