-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathgulpfile.esm.js
64 lines (57 loc) · 1.86 KB
/
gulpfile.esm.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
import gulp from 'gulp';
import sourcemaps from 'gulp-sourcemaps';
import cssnano from 'gulp-cssnano';
import autoprefixer from 'gulp-autoprefixer';
import rename from 'gulp-rename';
import concat from 'gulp-concat';
import terser from 'gulp-terser';
const sass = require('gulp-sass')(require('sass'));
const path = {
assets: './pola/assets',
static: './pola/static',
template: './pola/templates'
};
export function buildStyles() {
return gulp.src(`${path.assets}/scss/style.scss`)
.pipe(sourcemaps.init())
.pipe(sass({
includePaths: [
'./node_modules/bootstrap-sass/assets/stylesheets/',
'./node_modules/font-awesome/scss/',
]
}).on('error', sass.logError))
.pipe(autoprefixer())
.pipe(gulp.dest(`${path.static}/css`))
.pipe(rename({extname: '.min.css'}))
.pipe(cssnano())
.pipe(sourcemaps.write())
.pipe(gulp.dest(`${path.static}/css`))
}
export function buildScripts() {
return gulp.src([
'./node_modules/jquery/dist/jquery.js',
'./node_modules/bootstrap-sass/assets/javascripts/bootstrap.js',
'./node_modules/mousetrap/mousetrap.js',
`${path.assets}/js/*.js`
])
.pipe(sourcemaps.init())
.pipe(concat('backend.js'))
.pipe(gulp.dest(`${path.static}/js/`))
.pipe(terser())
.pipe(rename({extname: '.min.js'}))
.pipe(sourcemaps.write())
.pipe(gulp.dest(`${path.static}/js/`));
}
export function copyFonts() {
return gulp.src('./node_modules/font-awesome/fonts/**.*')
.pipe(gulp.dest(`${path.static}/fonts`))
}
export function watch() {
gulp.watch(`${path.assets}/scss/**.scss`, ['buildStyles']);
gulp.watch(`${path.assets}/js/**.js`, ['buildScripts']);
}
export default gulp.parallel(
buildStyles,
buildScripts,
copyFonts
)