2013-11-12 00:32:40 +01:00
|
|
|
module.exports = function(grunt) {
|
2014-02-23 20:23:52 +01:00
|
|
|
|
|
|
|
require('load-grunt-tasks')(grunt);
|
|
|
|
|
2013-11-12 00:32:40 +01:00
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
grunt.initConfig({
|
|
|
|
|
|
|
|
// Concatenate CSS files
|
|
|
|
concat: {
|
|
|
|
dist: {
|
|
|
|
src: [
|
|
|
|
// _base.css required for .animated helper class
|
|
|
|
'source/_base.css',
|
|
|
|
'source/**/*.css'
|
2013-11-23 22:24:22 +01:00
|
|
|
],
|
2013-11-12 00:32:40 +01:00
|
|
|
dest: 'animate.css'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
// Auto-prefix CSS properties using Can I Use?
|
|
|
|
autoprefixer: {
|
|
|
|
options: {
|
|
|
|
browsers: ['last 3 versions', 'bb 10', 'android 3']
|
|
|
|
},
|
|
|
|
no_dest: {
|
|
|
|
// File to output
|
|
|
|
src: 'animate.css'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// Minify CSS
|
2014-02-23 20:11:43 +01:00
|
|
|
cssmin: {
|
|
|
|
minify: {
|
|
|
|
src: ['animate.css'],
|
|
|
|
dest: 'animate.min.css',
|
|
|
|
},
|
2013-11-12 00:32:40 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
// Watch files for changes
|
|
|
|
watch: {
|
|
|
|
css: {
|
|
|
|
files: [
|
|
|
|
'source/**/*',
|
2013-11-23 22:24:22 +01:00
|
|
|
'!node_modules',
|
2014-02-23 20:11:43 +01:00
|
|
|
'animate-config.json'
|
2013-11-12 00:32:40 +01:00
|
|
|
],
|
|
|
|
// Run Sass, autoprefixer, and CSSO
|
2014-02-23 20:11:43 +01:00
|
|
|
tasks: ['concat-anim', 'autoprefixer', 'cssmin'],
|
2013-11-12 00:32:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
// Register our tasks
|
2014-02-23 20:11:43 +01:00
|
|
|
grunt.registerTask('default', ['concat-anim', 'autoprefixer', 'cssmin', 'watch']);
|
2013-11-23 22:24:22 +01:00
|
|
|
|
|
|
|
grunt.registerTask('concat-anim', 'Concatenates activated animations', function () {
|
2014-02-23 20:11:43 +01:00
|
|
|
var config = grunt.file.readJSON('animate-config.json'),
|
2013-11-23 22:24:22 +01:00
|
|
|
target = [ 'source/_base.css' ],
|
|
|
|
count = 0
|
|
|
|
|
|
|
|
for (var cat in config) {
|
|
|
|
for (var file in config[cat]) {
|
|
|
|
if (config[cat][file]) {
|
|
|
|
target.push('source/' + cat + '/' + file + '.css')
|
|
|
|
count++
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!count) {
|
|
|
|
grunt.log.writeln('No animations activated.')
|
|
|
|
}
|
|
|
|
|
|
|
|
grunt.log.writeln(count + (count > 1 ? ' animations' : ' animation') + ' activated.')
|
|
|
|
|
|
|
|
grunt.config('concat', { 'animate.css': target })
|
|
|
|
grunt.task.run('concat')
|
|
|
|
});
|
2014-02-23 20:23:52 +01:00
|
|
|
};
|