-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.mjs
51 lines (39 loc) · 1.19 KB
/
gulpfile.mjs
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
import gulp from 'gulp';
import gulpSass from 'gulp-sass';
import * as sass from 'sass';
import sourcemaps from 'gulp-sourcemaps';
import autoprefixer from 'autoprefixer';
import cssnano from 'cssnano';
import postcss from 'gulp-postcss';
import ttf2woff from 'gulp-ttf2woff';
import ttf2woff2 from 'gulp-ttf2woff2';
const { src, dest, watch, series } = gulp;
const sassCompiler = gulpSass(sass);
// Funciones
function css() {
return src('./src/scss/app.scss')
.pipe(sourcemaps.init())
.pipe(sassCompiler().on('error', sassCompiler.logError))
.pipe(postcss([autoprefixer({ overrideBrowserslist: ['last 1 version'] }), cssnano()]))
.pipe(sourcemaps.write('.'))
.pipe(dest('./build/css'));
}
function font() {
return src('./src/font/**/*')
.pipe(dest('./build/font/'));
}
function woff() {
return src('./src/font/**/*')
.pipe(ttf2woff())
.pipe(dest('./build/font/'));
}
function woff2() {
return src('./src/font/**/*')
.pipe(ttf2woff2())
.pipe(dest('./build/font/'));
}
function dev() {
watch('./src/scss/**/*.scss', css);
}
export { css, dev, font, woff, woff2 };
export default series(font, woff2, css, dev);