forked from riccardoscalco/crayon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
36 lines (33 loc) · 920 Bytes
/
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
var gulp = require('gulp');
var rename = require('gulp-rename');
var handlebars = require('gulp-compile-handlebars');
var sc = require('sc-color');
var firstBy = require('thenby.js');
var templateData = require('./src/crayon.json');
var scProp = function(propName){
return function(colorA, colorB) {
return sc(colorA.color)[propName]() - sc(colorB.color)[propName]();
};
};
templateData.prefix = '';
templateData.colors = Object.keys(templateData.colors)
.map(function(colorName){
return {
name: colorName,
color: templateData.colors[colorName]
};
})
.sort(
firstBy(scProp('hue'))
.thenBy(scProp('saturation'))
.thenBy(scProp('value'))
);
gulp.task('default', function() {
gulp
.src(['src/*'])
.pipe(handlebars(templateData))
.pipe(rename(function (path) {
path.extname = path.extname.replace('.hbs', '');
}))
.pipe(gulp.dest('dist/'));
});