-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgulpfile.js
More file actions
39 lines (33 loc) · 1.21 KB
/
gulpfile.js
File metadata and controls
39 lines (33 loc) · 1.21 KB
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
const gulp = require('gulp');
const gutil = require('gulp-util');
const replace = require('gulp-replace');
const notify = require('gulp-notify');
const less = require('gulp-less');
const cleanCSS = require('gulp-clean-css');
//const sourcemaps = require('gulp-sourcemaps');
const rename = require('gulp-rename');
const destination = 'generated-theme/';
gulp.task('compile-css', function () {
return gulp.src('webdatarocks.less')
//.pipe(sourcemaps.init())
.pipe(less().on('error', gutil.log))
//.pipe(sourcemaps.write())
.pipe(gulp.dest(destination));
});
gulp.task('adjust-assets', function(){
return gulp.src([destination+'webdatarocks.css'])
.pipe(replace('../assets', function(match) {
return 'https://cdn.webdatarocks.com/latest/theme/assets';
}))
.pipe(gulp.dest(destination));
});
gulp.task('minify-css',() => {
return gulp.src(destination+'webdatarocks.css')
//.pipe(sourcemaps.init())
.pipe(cleanCSS())
.pipe(rename({ suffix: ".min" }))
//.pipe(sourcemaps.write())
.pipe(gulp.dest(destination))
.pipe(notify('Generated theme in '+destination+' folder'));
});
gulp.task('default', gulp.series(['compile-css', 'adjust-assets', 'minify-css']));