Merge branch 'rework-grids'

This commit is contained in:
Eric Ferraiuolo 2013-11-26 01:54:12 -05:00
commit 0b9e047581
8 changed files with 102 additions and 234 deletions

View File

@ -184,6 +184,13 @@ grunt.initConfig({
}
},
// -- Grid Units Config ----------------------------------------------------
grid_units: {
dest : 'build/grids-units.css',
units: [5, 24]
},
// -- CSS Selectors Config -------------------------------------------------
css_selectors: {
@ -213,6 +220,7 @@ grunt.initConfig({
// -- Main Tasks ---------------------------------------------------------------
// npm tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
@ -222,13 +230,17 @@ grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-css-selectors');
// Local tasks.
grunt.loadTasks('tasks/');
grunt.registerTask('default', ['import', 'test', 'build']);
grunt.registerTask('import', ['bower-install']);
grunt.registerTask('import', ['bower_install']);
grunt.registerTask('test', ['csslint']);
grunt.registerTask('build', [
'clean:build',
'copy:build',
'css_selectors:base',
'grid_units',
'concat:build',
'clean:build_res',
'cssmin',
@ -245,61 +257,4 @@ grunt.registerTask('release', [
'compress:release'
]);
// -- Suppress Task ------------------------------------------------------------
grunt.registerTask('suppress', function () {
var allowed = ['success', 'fail', 'warn', 'error'];
grunt.util.hooker.hook(grunt.log, {
passName: true,
pre: function (name) {
if (allowed.indexOf(name) === -1) {
grunt.log.muted = true;
}
},
post: function () {
grunt.log.muted = false;
}
});
});
// -- Bower Tasks --------------------------------------------------------------
grunt.registerTask('bower-install', 'Installs Bower dependencies.', function () {
var bower = require('bower'),
done = this.async();
bower.commands.install()
.on('log', function (data) {
if (data.id !== 'install') { return; }
grunt.log.writeln('bower ' + data.id.cyan + ' ' + data.message);
})
.on('end', function (results) {
if (!Object.keys(results).length) {
grunt.log.writeln('No bower packages to install.');
}
done();
});
});
// -- License Task -------------------------------------------------------------
grunt.registerMultiTask('license', 'Stamps license banners on files.', function () {
var options = this.options({banner: ''}),
banner = grunt.template.process(options.banner),
tally = 0;
this.files.forEach(function (filePair) {
filePair.src.forEach(function (file) {
grunt.file.write(file, banner + grunt.file.read(file));
tally += 1;
});
});
grunt.log.writeln('Stamped license on ' + String(tally).cyan + ' files.');
});
};

View File

@ -9,6 +9,7 @@
"devDependencies": {
"bower": "~1.2.5",
"grunt": "~0.4.1",
"grunt-cli": "~0.1.9",
"grunt-contrib-cssmin": "~0.6.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-copy": "~0.4.1",
@ -17,6 +18,6 @@
"grunt-contrib-csslint": "~0.1.2",
"grunt-contrib-watch": "~0.5.3",
"grunt-css-selectors": "~0.1.0",
"grunt-cli": "~0.1.9"
"rework-pure-grids": "0.0.2"
}
}

13
src/grids/README.md Normal file
View File

@ -0,0 +1,13 @@
Pure Grids
==========
Pure Grids ship with build-in 5ths- and 24ths-based units styles. The unit style
rules are generated via Pure's [`rework-pure-grids`][rework-pure-grids]
[Rework][] plugin.
The tooling used by Pure to generate its built-in Grids can also be used to
create custom Grids that use any nth-unit base.
[rework-pure-grids]: https://github.com/ericf/rework-pure-grids
[Rework]: https://github.com/visionmedia/rework

View File

@ -1,175 +0,0 @@
.pure-u-1,
.pure-u-1-2,
.pure-u-1-3,
.pure-u-2-3,
.pure-u-1-4,
.pure-u-3-4,
.pure-u-1-5,
.pure-u-2-5,
.pure-u-3-5,
.pure-u-4-5,
.pure-u-1-6,
.pure-u-5-6,
.pure-u-1-8,
.pure-u-3-8,
.pure-u-5-8,
.pure-u-7-8,
.pure-u-1-12,
.pure-u-5-12,
.pure-u-7-12,
.pure-u-11-12,
.pure-u-1-24,
.pure-u-5-24,
.pure-u-7-24,
.pure-u-11-24,
.pure-u-13-24,
.pure-u-17-24,
.pure-u-19-24,
.pure-u-23-24 {
display: inline-block;
*display: inline; /* IE < 8: fake inline-block */
zoom: 1;
letter-spacing: normal;
word-spacing: normal;
vertical-align: top;
text-rendering: auto;
}
.pure-u-1 {
width: 100%;
}
.pure-u-1-2 {
width: 50%;
*width: 49.969%;
}
.pure-u-1-3 {
width: 33.3333%;
*width: 33.3023%;
}
.pure-u-2-3 {
width: 66.6667%;
*width: 66.6357%;
}
.pure-u-1-4 {
width: 25%;
*width: 24.969%;
}
.pure-u-3-4 {
width: 75%;
*width: 74.969%;
}
.pure-u-1-5 {
width: 20%;
*width: 19.969%;
}
.pure-u-2-5 {
width: 40%;
*width: 39.969%;
}
.pure-u-3-5 {
width: 60%;
*width: 59.969%;
}
.pure-u-4-5 {
width: 80%;
*width: 79.969%;
}
.pure-u-1-6 {
width: 16.6667%;
*width: 16.6357%;
}
.pure-u-5-6 {
width: 83.3333%;
*width: 83.3023%;
}
.pure-u-1-8 {
width: 12.5%;
*width: 12.469%;
}
.pure-u-3-8 {
width: 37.5%;
*width: 37.469%;
}
.pure-u-5-8 {
width: 62.5%;
*width: 62.469%;
}
.pure-u-7-8 {
width: 87.5%;
*width: 87.469%;
}
.pure-u-1-12 {
width: 8.3333%;
*width: 8.3023%;
}
.pure-u-5-12 {
width: 41.6667%;
*width: 41.6357%;
}
.pure-u-7-12 {
width: 58.3333%;
*width: 58.3023%;
}
.pure-u-11-12 {
width: 91.6667%;
*width: 91.6357%;
}
.pure-u-1-24 {
width: 4.1667%;
*width: 4.1357%;
}
.pure-u-5-24 {
width: 20.8333%;
*width: 20.8023%;
}
.pure-u-7-24 {
width: 29.1667%;
*width: 29.1357%;
}
.pure-u-11-24 {
width: 45.8333%;
*width: 45.8023%;
}
.pure-u-13-24 {
width: 54.1667%;
*width: 54.1357%;
}
.pure-u-17-24 {
width: 70.8333%;
*width: 70.8023%;
}
.pure-u-19-24 {
width: 79.1667%;
*width: 79.1357%;
}
.pure-u-23-24 {
width: 95.8333%;
*width: 95.8023%;
}

21
tasks/bower_install.js Normal file
View File

@ -0,0 +1,21 @@
'use strict';
module.exports = function (grunt) {
grunt.registerTask('bower_install', 'Installs Bower dependencies.', function () {
var bower = require('bower'),
done = this.async();
bower.commands.install()
.on('log', function (data) {
if (data.id !== 'install') { return; }
grunt.log.writeln('bower ' + data.id.cyan + ' ' + data.message);
})
.on('end', function (results) {
if (!Object.keys(results).length) {
grunt.log.writeln('No bower packages to install.');
}
done();
});
});
};

14
tasks/grid_units.js Normal file
View File

@ -0,0 +1,14 @@
'use strict';
var rework = require('rework'),
pureGrids = require('rework-pure-grids');
module.exports = function (grunt) {
grunt.registerTask('grid_units', 'Generates grid units.', function (target) {
var config = grunt.config.get(this.name),
css = rework('').use(pureGrids.units(config.units));
grunt.file.write(config.dest, css.toString({indent: ' '}));
grunt.log.writeln('File "' + config.dest + '" created.');
});
};

18
tasks/license.js Normal file
View File

@ -0,0 +1,18 @@
'use strict';
module.exports = function (grunt) {
grunt.registerMultiTask('license', 'Stamps license banners on files.', function () {
var options = this.options({banner: ''}),
banner = grunt.template.process(options.banner),
tally = 0;
this.files.forEach(function (filePair) {
filePair.src.forEach(function (file) {
grunt.file.write(file, banner + grunt.file.read(file));
tally += 1;
});
});
grunt.log.writeln('Stamped license on ' + String(tally).cyan + ' files.');
});
};

21
tasks/suppress.js Normal file
View File

@ -0,0 +1,21 @@
'use strict';
module.exports = function (grunt) {
grunt.registerTask('suppress', 'Suppresses noisy logs', function () {
var allowed = ['success', 'fail', 'warn', 'error'];
grunt.util.hooker.hook(grunt.log, {
passName: true,
pre: function (name) {
if (allowed.indexOf(name) === -1) {
grunt.log.muted = true;
}
},
post: function () {
grunt.log.muted = false;
}
});
});
};