Blame view

frontend/web/css/node_modules/animate.css/Gruntfile.js 1.91 KB
3da83322   Administrator   21.03.16 Versrka
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
74
75
76
77
78
79
  module.exports = function(grunt) {

  

    require('load-grunt-tasks')(grunt);

  

    var concatAnim;

  

    grunt.initConfig({

  

      pkg: grunt.file.readJSON('package.json'),

  

      concat: {

        dist: {

          src: [ 'source/_base.css', 'source/**/*.css' ], // _base.css required for .animated helper class

          dest: 'animate.css'

        }

      },

  

      autoprefixer: { // https://github.com/nDmitry/grunt-autoprefixer

        options: {

          browsers: ['last 2 versions', 'bb 10']

        },

        no_dest: {

          src: 'animate.css' // output file

        }

      },

  

      cssmin: {

        minify: {

          src: ['animate.css'],

          dest: 'animate.min.css',

        }

      },

  

      watch: {

        css: {

          files: [ 'source/**/*', 'animate-config.json' ],

          tasks: ['default']

        }

      }

  

    });

  

    // fuction to perform custom task

    concatAnim = function () {

  

      var categories = grunt.file.readJSON('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) {

        grunt.log.writeln('No animations activated.');

      } else {

        grunt.log.writeln(count + (count > 1 ? ' animations' : ' animation') + ' activated.');

      }

  

      grunt.config('concat', { 'animate.css': target });

      grunt.task.run('concat');

  

    };

  

    // register task

    grunt.registerTask('concat-anim', 'Concatenates activated animations', concatAnim); // custom task

    grunt.registerTask('default', ['concat-anim', 'autoprefixer', 'cssmin']);

    grunt.registerTask('dev', ['watch']);

  

  };