forked from poanetwork/poa-faucet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·62 lines (56 loc) · 1.69 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
'use strict'
const gulp = require('gulp')
const sass = require('gulp-sass')
const sassGlob = require('gulp-sass-glob')
const autoprefixer = require('gulp-autoprefixer')
const uglifycss = require('gulp-uglifycss')
const include = require('gulp-include')
const addsrc = require('gulp-add-src')
const order = require('gulp-order')
const concat = require('gulp-concat')
const concatCss = require('gulp-concat-css')
const uglify = require('gulp-uglify')
const nodemon = require('nodemon')
gulp.task('sass', function () {
return gulp.src([
'public/assets/stylesheets/*.scss',
'./public/assets/stylesheets/sweetalert2.min.css'
])
.pipe(sassGlob())
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer())
.pipe(concatCss('application.css'))
.pipe(uglifycss())
.pipe(gulp.dest('public/assets/stylesheets/'))
})
gulp.task('javascript', function () {
return gulp.src('public/assets/javascripts/application/*.js')
.pipe(addsrc('public/assets/javascripts/vendor/index.js'))
.pipe(order([
'public/assets/javascripts/vendor/index.js',
'public/assets/javascripts/application/*.js'
], {base: '.'}))
.pipe(include())
.pipe(concat('application.js'))
// .pipe(uglify())
.pipe(gulp.dest('public/assets/javascripts'))
})
gulp.task('nodemon', function () {
nodemon({
script: 'index.js',
ignore: 'public'
})
})
gulp.task('build', function () {
gulp.run('javascript')
gulp.run('sass')
})
gulp.task('watch', function () {
gulp.run('build')
gulp.watch('public/assets/stylesheets/**/**/*.scss', ['sass'])
gulp.watch('public/assets/javascripts/application/*.js', ['javascript'])
nodemon({
script: 'index.js',
ignore: 'public'
})
})