-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
49 lines (44 loc) · 1.2 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
var gulp = require('gulp')
var postcss = require('gulp-postcss')
var rucksack = require('rucksack-css')
var cssnested = require('postcss-nested')
var cssnext = require('postcss-cssnext')
var mixins = require('postcss-mixins')
var lost = require('lost')
var atImport = require('postcss-import')
var csswring = require('csswring')
var mqpacker = require('css-mqpacker')
var browserSync = require('browser-sync').create()
// Servidor de desarrollo
gulp.task('serve', function () {
browserSync.init({
server: {
baseDir: './'
}
})
})
// Tarea para procesar el CSS
gulp.task('css', function () {
var processors = [
atImport(),
mixins(),
lost(),
rucksack(),
cssnested,
cssnext({ browsers: ['> 5%', 'ie 8']}),
mqpacker(),
csswring()
]
return gulp.src('./src/main.css')
.pipe(postcss(processors))
.pipe(gulp.dest('./dist/css'))
.pipe(browserSync.stream())
})
// Tarea para vigilar los cambios
gulp.task('watch', function () {
gulp.watch('./src/*.css', ['css'])
gulp.watch('./src/**/*.css', ['css'])
gulp.watch('./dist/js/*.js').on('change', browserSync.reload)
gulp.watch('./*.html').on('change', browserSync.reload)
})
gulp.task('default', ['watch', 'serve'])