This repository has been archived by the owner on May 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
78 lines (65 loc) · 1.85 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
const gulp = require('gulp')
const rollup = require('rollup')
// Gulp plugins
const sass = require('gulp-sass')
const cleancss = require('gulp-clean-css')
const csscomb = require('gulp-csscomb')
const autoprefixer = require('gulp-autoprefixer')
// Rollup plugins
const buble = require('rollup-plugin-buble')
const commonjs = require('rollup-plugin-commonjs')
const globals = require('rollup-plugin-node-globals')
const resolve = require('rollup-plugin-node-resolve')
const uglify = require('rollup-plugin-uglify')
const project_base = './src/nouvelles/static/'
const paths = {
source: {
scss: project_base + 'src/scss/*.scss',
js: project_base + 'src/js/app.js',
},
dest: {
css: project_base + 'css',
js: project_base + 'js/teamlogger.js'
},
}
/* Begin build tasks definition */
gulp.task('build:styles', () => {
return gulp.src(paths.source.scss)
.pipe(sass({ outputStyle: 'compact', precision: 10 })
.on('error', sass.logError)
)
.pipe(autoprefixer())
.pipe(csscomb())
.pipe(cleancss())
.pipe(gulp.dest(paths.dest.css))
})
gulp.task('build:js', () => {
return rollup.rollup({
input: paths.source.js,
plugins: [
buble(),
resolve({ browser: true, jsnext: true, main: true }),
commonjs(),
globals(),
uglify()
]
}).then(bundle => {
return bundle.write({
file: paths.dest.js,
format: 'iife',
sourcemap: true,
})
})
})
/* End of build tasks definition */
/* Begin watch tasks definition */
gulp.task('watch:styles', () => {
gulp.watch(project_base + 'src/scss/**/*.scss', ['build:styles'])
})
gulp.task('watch:js', () => {
gulp.watch(project_base + 'src/js/**/*', ['build:js'])
})
/* End of watch tasks definition */
gulp.task('watch', ['watch:styles', 'watch:js'])
gulp.task('build', ['build:styles', 'build:js'])
gulp.task('default', ['build'])