-
Notifications
You must be signed in to change notification settings - Fork 13
/
gulpfile.js
56 lines (49 loc) · 1.31 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
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var path = require('path');
var watch = require('gulp-watch');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var cleanCSS = require('gulp-clean-css');
var dir = {
fonts: './Resources/fonts/',
sass: './Resources/sass/',
js: './Resources/js/',
dist: './Resources/public/',
npm: './node_modules/',
};
var assets = {
styles: dir.sass + '**/*.scss',
};
gulp.task('app-sass', function () {
return gulp.src([
dir.sass + 'style.scss',
dir.npm + 'datatables.net-buttons-bs/css/buttons.bootstrap.css',
])
.pipe(sourcemaps.init())
.pipe(sass(
{outputStyle: 'compressed'}
).on('error', sass.logError))
.pipe(concat('style.css'))
.pipe(cleanCSS())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(dir.dist));
});
gulp.task('app-js', function () {
return gulp.src([
dir.js + 'script.js',
])
.pipe(uglify())
.pipe(concat('script.js'))
.pipe(gulp.dest(dir.dist));
});
// Rerun the task when a file changes
gulp.task('watch', function () {
gulp.watch(assets.styles, ['app-sass', 'app-js']);
});
gulp.task(
'default',
['app-sass', 'app-js']
);