-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
47 lines (40 loc) · 1.32 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
const gulp = require('gulp');
const sass = require('gulp-sass');
const sourcemaps = require('gulp-sourcemaps');
const uglify = require('gulp-uglifyjs');
const config = {
bowerDir: './bower_components',
publicDir: './template/public',
sassPath: './template/css',
};
gulp.task('fonts', () => gulp.src([
`${config.bowerDir}/bootstrap-sass/assets/fonts/**/*`,
])
.pipe(gulp.dest(`${config.publicDir}/fonts`)));
gulp.task('icons', () => gulp.src([
`${config.bowerDir}/font-awesome/fonts/**/*`,
])
.pipe(gulp.dest(`${config.publicDir}/fonts`)));
gulp.task('js', () => gulp.src([
`${config.bowerDir}/jquery/dist/jquery.min.js`,
`${config.bowerDir}/bootstrap-sass/assets/javascripts/bootstrap.js`,
])
.pipe(uglify('app.js', {
compress: false,
outSourceMap: true,
}))
.pipe(gulp.dest(`${config.publicDir}/js`)));
gulp.task('css', () => gulp.src('template/css/app.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'compressed',
includePaths: [`${config.bowerDir}/bootstrap-sass/assets/stylesheets`,
`${config.bowerDir}/font-awesome/css`],
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest(`${config.publicDir}/css`)));
// Rerun the task when a file changes
gulp.task('watch', () => {
gulp.watch(`${config.sassPath}/**/*.scss`, ['css']);
});
gulp.task('default', ['css', 'js', 'fonts', 'icons']);