Skip to content

Commit c3e5360

Browse files
committed
Add gulpfile and update package.json
1 parent 069a87f commit c3e5360

2 files changed

Lines changed: 65 additions & 7 deletions

File tree

gulpfile.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Utilities
2+
var fs = require('fs');
3+
4+
// Gulp
5+
var gulp = require('gulp');
6+
7+
// Gulp plugins
8+
var gutil = require('gulp-util');
9+
var concat = require('gulp-concat');
10+
11+
// Misc/global vars
12+
var pkg = JSON.parse(fs.readFileSync('package.json'));
13+
var banner = [
14+
'/*!',
15+
' * <%= name %> -<%= homepage %>',
16+
' * Version - <%= version %>',
17+
' * Licensed under the MIT license - http://opensource.org/licenses/MIT',
18+
' *',
19+
' * Copyright (c) <%= new Date().getFullYear() %> <%= author.name %>',
20+
' */',
21+
].join('\n');
22+
23+
// Read the config file and return an array of the animations to be activated
24+
var activatedAnimations = function () {
25+
var categories = JSON.parse(fs.readFileSync('animate-config.json')),
26+
category, files, file,
27+
target = [ 'source/_base.css' ],
28+
count = 0;
29+
30+
for (category in categories) {
31+
if (categories.hasOwnProperty(category)) {
32+
files = categories[category];
33+
34+
for (file in files) {
35+
if (files.hasOwnProperty(file) && files[file]) {
36+
target.push('source/' + category + '/' + file + '.css');
37+
count += 1;
38+
}
39+
}
40+
}
41+
}
42+
43+
if (!count) {
44+
gutil.log('No animations activated.');
45+
} else {
46+
gutil.log(count + (count > 1 ? ' animations' : ' animation') + ' activated.');
47+
}
48+
49+
return target;
50+
};
51+
52+
gulp.task('default', function() {
53+
54+
});
55+
56+
gulp.task('concatCSS', function() {
57+
return gulp.src(activatedAnimations)
58+
.pipe(concat('animate.css'))
59+
.pipe(gulp.dest('./'));
60+
});

package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@
2020
}
2121
},
2222
"devDependencies": {
23-
"grunt": "~0.4.1",
24-
"grunt-autoprefixer": "~0.4.0",
25-
"grunt-contrib-watch": "~0.5.3",
26-
"grunt-banner": "~0.6.0",
27-
"grunt-contrib-concat": "~0.3.0",
28-
"grunt-contrib-cssmin": "~0.8.0",
29-
"load-grunt-tasks": "~0.2.0"
23+
"gulp": "^3.9.0",
24+
"gulp-concat": "^2.6.0"
3025
},
3126
"spm": {
3227
"main": "./animate.css"
28+
},
29+
"dependencies": {
30+
"gulp-header": "^1.7.1"
3331
}
3432
}

0 commit comments

Comments
 (0)