Add gulpfile and update package.json

This commit is contained in:
Daniel Eden 2015-12-14 11:03:02 -08:00
parent 069a87fd6f
commit c3e536093a
2 changed files with 65 additions and 7 deletions

60
gulpfile.js Normal file
View File

@ -0,0 +1,60 @@
// Utilities
var fs = require('fs');
// Gulp
var gulp = require('gulp');
// Gulp plugins
var gutil = require('gulp-util');
var concat = require('gulp-concat');
// Misc/global vars
var pkg = JSON.parse(fs.readFileSync('package.json'));
var banner = [
'/*!',
' * <%= name %> -<%= homepage %>',
' * Version - <%= version %>',
' * Licensed under the MIT license - http://opensource.org/licenses/MIT',
' *',
' * Copyright (c) <%= new Date().getFullYear() %> <%= author.name %>',
' */',
].join('\n');
// Read the config file and return an array of the animations to be activated
var activatedAnimations = function () {
var categories = JSON.parse(fs.readFileSync('animate-config.json')),
category, files, file,
target = [ 'source/_base.css' ],
count = 0;
for (category in categories) {
if (categories.hasOwnProperty(category)) {
files = categories[category];
for (file in files) {
if (files.hasOwnProperty(file) && files[file]) {
target.push('source/' + category + '/' + file + '.css');
count += 1;
}
}
}
}
if (!count) {
gutil.log('No animations activated.');
} else {
gutil.log(count + (count > 1 ? ' animations' : ' animation') + ' activated.');
}
return target;
};
gulp.task('default', function() {
});
gulp.task('concatCSS', function() {
return gulp.src(activatedAnimations)
.pipe(concat('animate.css'))
.pipe(gulp.dest('./'));
});

View File

@ -20,15 +20,13 @@
}
},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-autoprefixer": "~0.4.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-banner": "~0.6.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-cssmin": "~0.8.0",
"load-grunt-tasks": "~0.2.0"
"gulp": "^3.9.0",
"gulp-concat": "^2.6.0"
},
"spm": {
"main": "./animate.css"
},
"dependencies": {
"gulp-header": "^1.7.1"
}
}