Skip to content

Commit 0b9e047

Browse files
committed
Merge branch 'rework-grids'
2 parents 30de24a + a4c0ade commit 0b9e047

File tree

8 files changed

+102
-234
lines changed

8 files changed

+102
-234
lines changed

Gruntfile.js

Lines changed: 13 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,13 @@ grunt.initConfig({
184184
}
185185
},
186186

187+
// -- Grid Units Config ----------------------------------------------------
188+
189+
grid_units: {
190+
dest : 'build/grids-units.css',
191+
units: [5, 24]
192+
},
193+
187194
// -- CSS Selectors Config -------------------------------------------------
188195

189196
css_selectors: {
@@ -213,6 +220,7 @@ grunt.initConfig({
213220

214221
// -- Main Tasks ---------------------------------------------------------------
215222

223+
// npm tasks.
216224
grunt.loadNpmTasks('grunt-contrib-clean');
217225
grunt.loadNpmTasks('grunt-contrib-copy');
218226
grunt.loadNpmTasks('grunt-contrib-concat');
@@ -222,13 +230,17 @@ grunt.loadNpmTasks('grunt-contrib-compress');
222230
grunt.loadNpmTasks('grunt-contrib-watch');
223231
grunt.loadNpmTasks('grunt-css-selectors');
224232

233+
// Local tasks.
234+
grunt.loadTasks('tasks/');
235+
225236
grunt.registerTask('default', ['import', 'test', 'build']);
226-
grunt.registerTask('import', ['bower-install']);
237+
grunt.registerTask('import', ['bower_install']);
227238
grunt.registerTask('test', ['csslint']);
228239
grunt.registerTask('build', [
229240
'clean:build',
230241
'copy:build',
231242
'css_selectors:base',
243+
'grid_units',
232244
'concat:build',
233245
'clean:build_res',
234246
'cssmin',
@@ -245,61 +257,4 @@ grunt.registerTask('release', [
245257
'compress:release'
246258
]);
247259

248-
// -- Suppress Task ------------------------------------------------------------
249-
250-
grunt.registerTask('suppress', function () {
251-
var allowed = ['success', 'fail', 'warn', 'error'];
252-
253-
grunt.util.hooker.hook(grunt.log, {
254-
passName: true,
255-
256-
pre: function (name) {
257-
if (allowed.indexOf(name) === -1) {
258-
grunt.log.muted = true;
259-
}
260-
},
261-
262-
post: function () {
263-
grunt.log.muted = false;
264-
}
265-
});
266-
});
267-
268-
// -- Bower Tasks --------------------------------------------------------------
269-
270-
grunt.registerTask('bower-install', 'Installs Bower dependencies.', function () {
271-
var bower = require('bower'),
272-
done = this.async();
273-
274-
bower.commands.install()
275-
.on('log', function (data) {
276-
if (data.id !== 'install') { return; }
277-
grunt.log.writeln('bower ' + data.id.cyan + ' ' + data.message);
278-
})
279-
.on('end', function (results) {
280-
if (!Object.keys(results).length) {
281-
grunt.log.writeln('No bower packages to install.');
282-
}
283-
284-
done();
285-
});
286-
});
287-
288-
// -- License Task -------------------------------------------------------------
289-
290-
grunt.registerMultiTask('license', 'Stamps license banners on files.', function () {
291-
var options = this.options({banner: ''}),
292-
banner = grunt.template.process(options.banner),
293-
tally = 0;
294-
295-
this.files.forEach(function (filePair) {
296-
filePair.src.forEach(function (file) {
297-
grunt.file.write(file, banner + grunt.file.read(file));
298-
tally += 1;
299-
});
300-
});
301-
302-
grunt.log.writeln('Stamped license on ' + String(tally).cyan + ' files.');
303-
});
304-
305260
};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"devDependencies": {
1010
"bower": "~1.2.5",
1111
"grunt": "~0.4.1",
12+
"grunt-cli": "~0.1.9",
1213
"grunt-contrib-cssmin": "~0.6.0",
1314
"grunt-contrib-clean": "~0.5.0",
1415
"grunt-contrib-copy": "~0.4.1",
@@ -17,6 +18,6 @@
1718
"grunt-contrib-csslint": "~0.1.2",
1819
"grunt-contrib-watch": "~0.5.3",
1920
"grunt-css-selectors": "~0.1.0",
20-
"grunt-cli": "~0.1.9"
21+
"rework-pure-grids": "0.0.2"
2122
}
2223
}

src/grids/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Pure Grids
2+
==========
3+
4+
Pure Grids ship with build-in 5ths- and 24ths-based units styles. The unit style
5+
rules are generated via Pure's [`rework-pure-grids`][rework-pure-grids]
6+
[Rework][] plugin.
7+
8+
The tooling used by Pure to generate its built-in Grids can also be used to
9+
create custom Grids that use any nth-unit base.
10+
11+
12+
[rework-pure-grids]: https://github.com/ericf/rework-pure-grids
13+
[Rework]: https://github.com/visionmedia/rework

src/grids/css/grids-units.css

Lines changed: 0 additions & 175 deletions
This file was deleted.

tasks/bower_install.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
module.exports = function (grunt) {
4+
grunt.registerTask('bower_install', 'Installs Bower dependencies.', function () {
5+
var bower = require('bower'),
6+
done = this.async();
7+
8+
bower.commands.install()
9+
.on('log', function (data) {
10+
if (data.id !== 'install') { return; }
11+
grunt.log.writeln('bower ' + data.id.cyan + ' ' + data.message);
12+
})
13+
.on('end', function (results) {
14+
if (!Object.keys(results).length) {
15+
grunt.log.writeln('No bower packages to install.');
16+
}
17+
18+
done();
19+
});
20+
});
21+
};

tasks/grid_units.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
var rework = require('rework'),
4+
pureGrids = require('rework-pure-grids');
5+
6+
module.exports = function (grunt) {
7+
grunt.registerTask('grid_units', 'Generates grid units.', function (target) {
8+
var config = grunt.config.get(this.name),
9+
css = rework('').use(pureGrids.units(config.units));
10+
11+
grunt.file.write(config.dest, css.toString({indent: ' '}));
12+
grunt.log.writeln('File "' + config.dest + '" created.');
13+
});
14+
};

tasks/license.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
module.exports = function (grunt) {
4+
grunt.registerMultiTask('license', 'Stamps license banners on files.', function () {
5+
var options = this.options({banner: ''}),
6+
banner = grunt.template.process(options.banner),
7+
tally = 0;
8+
9+
this.files.forEach(function (filePair) {
10+
filePair.src.forEach(function (file) {
11+
grunt.file.write(file, banner + grunt.file.read(file));
12+
tally += 1;
13+
});
14+
});
15+
16+
grunt.log.writeln('Stamped license on ' + String(tally).cyan + ' files.');
17+
});
18+
};

tasks/suppress.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
module.exports = function (grunt) {
4+
grunt.registerTask('suppress', 'Suppresses noisy logs', function () {
5+
var allowed = ['success', 'fail', 'warn', 'error'];
6+
7+
grunt.util.hooker.hook(grunt.log, {
8+
passName: true,
9+
10+
pre: function (name) {
11+
if (allowed.indexOf(name) === -1) {
12+
grunt.log.muted = true;
13+
}
14+
},
15+
16+
post: function () {
17+
grunt.log.muted = false;
18+
}
19+
});
20+
});
21+
};

0 commit comments

Comments
 (0)