~stephen-stewart/ulysses/flat-buttons

« back to all changes in this revision

Viewing changes to Gruntfile.js

  • Committer: Tarmac
  • Author(s): Stephen Stewart
  • Date: 2014-09-25 09:26:43 UTC
  • mfrom: (43.1.14 gulpify-and-update)
  • Revision ID: tarmac-20140925092643-jzluuaboybxm4q73
[r=james-w] update to version 1.0.0

* update grids to pure 0.5
* default to border-box
* default to minified css
* switch to gulp
* remove bower dep
* svg symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
module.exports = function(grunt) {
2
 
    grunt.initConfig({
3
 
        pkg: grunt.file.readJSON('package.json'),
4
 
 
5
 
        clean: {
6
 
            build: ['tmp', 'public']
7
 
        },
8
 
 
9
 
        compress: {
10
 
            release: {
11
 
                options: {
12
 
                    archive: 'release/<%= pkg.version %>/<%= pkg.name %>-<%= pkg.version %>.tar.gz'
13
 
                },
14
 
 
15
 
                expand : true,
16
 
                flatten: true,
17
 
                src : 'public/*',
18
 
                dest : '<%= pkg.name %>/<%= pkg.version %>/'
19
 
            }
20
 
        },
21
 
 
22
 
        copy: {
23
 
            release: {
24
 
                src : '{LICENSE.md,README.md,HISTORY.md}',
25
 
                dest: 'public/'
26
 
            },
27
 
            icons: {
28
 
                expand: true,
29
 
                cwd: 'src/',
30
 
                src: 'icons/**',
31
 
                dest: 'public/icons',
32
 
                flatten: true,
33
 
                filter: 'isFile',
34
 
            },
35
 
        },
36
 
 
37
 
        csslint: {
38
 
            options: {
39
 
                csslintrc: '.csslintrc'
40
 
            },
41
 
 
42
 
            src: {
43
 
                src: 'src/*.css'
44
 
            }
45
 
        },
46
 
 
47
 
        concat: {
48
 
            build: {
49
 
                files: [
50
 
                    {'public/base.css': [
51
 
                        'bower_components/normalize-css/normalize.css',
52
 
                        'public/base.css'
53
 
                    ]},
54
 
                    {'public/grids.css': [
55
 
                        'tmp/grids-prefixed.css',
56
 
                        'public/grids.css'
57
 
                    ]},
58
 
                    // rollup
59
 
                    {'public/<%= pkg.name %>.css': [
60
 
                        'public/base.css',
61
 
                        'public/buttons.css',
62
 
                        'public/dropdowns.css',
63
 
                        'public/forms.css',
64
 
                        'public/grids.css',
65
 
                        'public/icons.css',
66
 
                        'public/layout.css',
67
 
                        'public/feedback.css',
68
 
                        'public/navigation.css',
69
 
                        'public/navbar.css',
70
 
                        'public/searchbar.css',
71
 
                        'public/tables.css',
72
 
                        'public/typography.css'
73
 
                    ]}
74
 
                ]
75
 
            }
76
 
        },
77
 
 
78
 
        cssmin: {
79
 
            minify: {
80
 
                expand: true,
81
 
                cwd: 'public/',
82
 
                src: ['**.css', '!*-min.css'],
83
 
                dest: 'public/',
84
 
                ext: '-min.css'
85
 
            }
86
 
        },
87
 
 
88
 
        watch: {
89
 
            css: {
90
 
                files: 'src/**/*.css',
91
 
                tasks: ['rework', 'concat'],
92
 
                options: {
93
 
                    spawn: false
94
 
                }
95
 
            }
96
 
        },
97
 
 
98
 
        connect: {
99
 
            server: {
100
 
                options: {
101
 
                    port: 9001,
102
 
                    hostname: '*',
103
 
                    base: 'test'
104
 
                }
105
 
            }
106
 
        },
107
 
        rework: {
108
 
            files: {
109
 
                expand: true,
110
 
                cwd: 'src/',
111
 
                src: ['**/*.css'],
112
 
                dest: 'public/',
113
 
                ext: '.css'
114
 
            },
115
 
            options: {
116
 
                use: [
117
 
                    ['rework.keyframes'],
118
 
                    ['rework.prefix', 'border-radius'],
119
 
                    ['rework.prefix', 'box-shadow'],
120
 
                    ['rework.prefix', 'box-sizing'],
121
 
                    ['rework.prefix', 'animation'],
122
 
                    ['rework.prefix', 'transition'],
123
 
                    ['rework.prefix', 'appearance'],
124
 
                    ['rework.prefixValue', 'linear-gradient']
125
 
                ],
126
 
                vendors: ['-o-', '-ms-', '-moz-', '-webkit-']
127
 
            }
128
 
        },
129
 
 
130
 
        css_selectors: {
131
 
            options: {
132
 
                mutations: [
133
 
                    {search: /([\.|\"])pure/g, replace: '$1ues'}
134
 
                ]
135
 
            },
136
 
            pure_grids: {
137
 
                files: [
138
 
                    {dest: 'tmp/grids-prefixed.css', src: 'bower_components/pure/grids.css'}
139
 
                ]
140
 
            }
141
 
        },
142
 
 
143
 
        phantomcss: {
144
 
            desktop: {
145
 
                options: {
146
 
                    screenshots: 'test/visual/screenshots/desktop',
147
 
                    results: 'test_results/visual/desktop'
148
 
                },
149
 
                src: [
150
 
                    'test/visual/config/desktop.js'
151
 
                ]
152
 
            },
153
 
            smallscreen: {
154
 
                options: {
155
 
                    screenshots: 'test/visual/screenshots/smallscreen',
156
 
                    results: 'test_results/visual/smallscreen',
157
 
                    viewportSize: [320, 480]
158
 
                },
159
 
                src: [
160
 
                    'test/visual/config/smallscreen.js'
161
 
                ]
162
 
            },
163
 
        }
164
 
    });
165
 
 
166
 
    // configure csslint to only run on changed file
167
 
    grunt.event.on('watch', function(action, filepath) {
168
 
        grunt.config('csslint.src', filepath);
169
 
    });
170
 
 
171
 
 
172
 
    grunt.loadNpmTasks('grunt-contrib-clean');
173
 
    grunt.loadNpmTasks('grunt-contrib-compress');
174
 
    grunt.loadNpmTasks('grunt-contrib-concat');
175
 
    grunt.loadNpmTasks('grunt-contrib-copy');
176
 
    grunt.loadNpmTasks('grunt-contrib-csslint');
177
 
    grunt.loadNpmTasks('grunt-contrib-cssmin');
178
 
    grunt.loadNpmTasks('grunt-contrib-watch');
179
 
    grunt.loadNpmTasks('grunt-contrib-connect');
180
 
    grunt.loadNpmTasks('grunt-rework');
181
 
    grunt.loadNpmTasks('grunt-css-selectors');
182
 
    grunt.loadNpmTasks('grunt-phantomcss');
183
 
 
184
 
    grunt.registerTask('default',['run']);
185
 
    grunt.registerTask('test', ['build', 'connect', 'phantomcss']);
186
 
    grunt.registerTask('run', ['build', 'connect', 'watch']);
187
 
    grunt.registerTask('build', [
188
 
                       'clean:build',
189
 
                       'rework',
190
 
                       'csslint',
191
 
                       'css_selectors',
192
 
                       'concat',
193
 
                       'copy:icons',
194
 
                       'cssmin'
195
 
    ]);
196
 
    grunt.registerTask('release', [
197
 
        'build',
198
 
        'copy:release',
199
 
        'compress:release'
200
 
    ]);
201
 
}