This repository has been archived by the owner on Jul 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgulpfile.js
85 lines (80 loc) · 2.48 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var clip = require('gulp-clip-empty-files');
var del = require('del');
var iconfont = require('gulp-iconfont');
var consolidate = require('gulp-consolidate');
var rename = require('gulp-rename');
var include = require("gulp-include");
var _ = require('lodash');
gulp.task('default', ['styles', 'javascript', 'design']);
gulp.task('clean', ['styles:clean', 'javascript:clean', 'design:clean']);
gulp.task('styles', ['styles:build']);
gulp.task('styles:build', ['styles:clean'], function() {
return gulp.src('./web/src/stylesheets/**/*.scss')
.pipe(clip())
.pipe(sass({
outputStyle: 'expanded'
}))
.pipe(autoprefixer({
browsers: ['> 1%', 'last 2 versions', 'ie >= 9'],
cascade: false
}))
.pipe(gulp.dest('./web/build/stylesheets'));
});
gulp.task('styles:clean', function(callback) {
del(['./web/build/stylesheets/']).then(function(data){
callback();
});
});
gulp.task('javascript', ['javascript:build']);
gulp.task('javascript:build', ['javascript:clean'], function() {
return gulp.src(['./web/src/javascript/**/*.js', '!./web/src/javascript/config/**/*'])
.pipe(include({
extensions: "js",
includePaths: [
"./web/src/javascript"
]
}))
.pipe(gulp.dest('./web/build/javascript'));
});
gulp.task('javascript:clean', function(callback) {
del(['./web/build/javascript']).then(function(data){
callback();
});
});
gulp.task('design', ['design:build']);
gulp.task('design:build', ['design:clean'], function() {
return gulp.src('./web/src/design/**/*')
.pipe(gulp.dest('./web/build/design'));
});
gulp.task('design:clean', function(callback) {
del(['./web/build/design']).then(function(data){
callback();
});
});
gulp.task('iconfont', function(){
return gulp.src('./font-glyphs/src/icons/*.svg')
.pipe(iconfont({
fontName: 'glyph-font', // required
appendCodepoints: true, // recommended option
startCodepoint: 0xF101,
fontHeight: 150
}))
.on('codepoints', function(codepoints, options) {
codepoints = _.map(codepoints, function(codepoint) {
return {
name: codepoint.name,
codepoint: codepoint.codepoint.toString(16).toLowerCase()
};
});
gulp.src('./font-glyphs/src/templates/_iconfont.scsstpl')
.pipe(consolidate('lodash', {
glyphs: codepoints
}))
.pipe(rename('_font-glyph-entities.scss'))
.pipe(gulp.dest('./web/src/stylesheets/config/'));
})
.pipe(gulp.dest('./web/src/design/fonts/glyph-lib/'));
});