-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgulpfile.js
More file actions
73 lines (61 loc) · 2.24 KB
/
gulpfile.js
File metadata and controls
73 lines (61 loc) · 2.24 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
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
'use strict';
var gulp = require('gulp');
var helper = require('component-helper');
var paths = require('./component.config.js').paths;
var argv = process.argv.slice(3).toString();
var iconfont = require("gulp-iconfont")
, consolidate = require('gulp-consolidate')
, lodash = require('lodash');
function onError(err) {
console.log(err.message || err);
process.exit(1);
}
gulp.task('build', ['build-skycons'], function() {
return helper.build.all().catch(onError)
});
gulp.task('serve', ['build'], function() {
return helper.serve.quick().catch(onError);
});
gulp.task('release', ['build'], function(){
var version = argv.split('--version=')[1];
return helper.release.quick(null, version).catch(onError);
});
gulp.task('copy-icons', function() {
return gulp.src([paths.source['icons'] + '/*.svg'])
.pipe(gulp.dest(paths.site['icons']));
});
gulp.task('copy-skycons', ['skycons'], function() {
return gulp.src([paths.site.root + '/fonts/skycons.*'])
.pipe(gulp.dest(paths.dist['fonts']));
});
gulp.task("skycons", function(){
var fontName = 'skycons';
return gulp.src(paths.source.icons + '/**/*.svg')
.pipe(iconfont({
fontName : fontName,
fixedWidth : false,
normalize: true,
centerHorizontally: true
}))
.on('codepoints', function(codepoints) {
var options = {
glyphs: codepoints,
fontName: fontName,
fontPath: '../fonts/'
};
// Prepare core SCSS partial
gulp.src(paths.source.root + '/skycons-core.scss')
.pipe(consolidate('lodash', options))
.pipe(gulp.dest(paths.source.styles));
// Create CSS
gulp.src(paths.source.root + '/skycons.scss')
.pipe(consolidate('lodash', options))
.pipe(gulp.dest(paths.source.styles));
// Create HTML preview
gulp.src(paths.source.root + '/index.html')
.pipe(consolidate('lodash', options))
.pipe(gulp.dest(paths.demo.root));
})
.pipe(gulp.dest(paths.site.root + '/fonts'));
});
gulp.task('build-skycons', ['copy-icons','skycons','copy-skycons']);