Skip to content
This repository has been archived by the owner on Apr 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #183 from tilomitra/mobile-first
Browse files Browse the repository at this point in the history
Mobile-first version of Pure's Website
  • Loading branch information
tilomitra committed Jan 21, 2014
2 parents 56b8dea + c4036d2 commit 2c93b4c
Show file tree
Hide file tree
Showing 50 changed files with 1,609 additions and 1,243 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
bower_components/
node_modules/
build/
npm-debug.log
deploy.json
grasshopper.json
112 changes: 112 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
'use strict';

module.exports = function (grunt) {
grunt.initConfig({
clean: {
build: ['build/']
},

copy : {
pub: {
src : 'public/**',
dest : 'build/',
expand : true
},

bower: {
cwd : 'bower_components/',
expand: true,
dest : 'build/public/vendor/',
src : ['rainbow/js/**']
}
},

grid_units: {
main: {
dest : 'build/public/css/main-grid.css',
options: {
mediaQueries: {
sm : 'screen and (min-width: 35.5em)', // 568px
med: 'screen and (min-width: 48em)', // 768px
lrg: 'screen and (min-width: 58em)', // 928px
xl : 'screen and (min-width: 75em)' // 1200px
}
}
},

gallery: {
dest : 'build/public/css/layouts/gallery-grid.css',
options: {
units: 6,
mediaQueries: {
med : 'screen and (min-width: 30em)',
lrg : 'screen and (min-width: 48em)'
}
}
}
},

stripmq: {
all: {
files: {
'build/public/css/main-grid-old-ie.css':
['build/public/css/main-grid.css'],

'build/public/css/main-old-ie.css':
['build/public/css/main.css'],


// Layout Grids
'build/public/css/layouts/gallery-grid-old-ie.css':
['build/public/css/layouts/gallery-grid.css'],

//Layout CSS
'build/public/css/layouts/blog-old-ie.css':
['build/public/css/layouts/blog.css'],

'build/public/css/layouts/marketing-old-ie.css':
['build/public/css/layouts/marketing.css'],

'build/public/css/layouts/pricing-old-ie.css':
['build/public/css/layouts/pricing.css'],

'build/public/css/layouts/side-menu-old-ie.css':
['build/public/css/layouts/side-menu.css'],

'build/public/css/layouts/gallery-old-ie.css':
['build/public/css/layouts/gallery.css'],

'build/public/css/layouts/email-old-ie.css':
['build/public/css/layouts/email.css']
}
}
},

observe: {
bower: {
files: ['bower_components/**', '!bower_components/pure/**'],
tasks: ['copy:bower']
},

pub: {
files: 'public/**',
tasks: ['default']
}
}
});

// npm tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-stripmq');

// Local tasks.
grunt.loadTasks('lib/tasks/');

grunt.registerTask('default', ['clean', 'copy', 'grid_units', 'stripmq']);

// Makes the `watch` task run a build first.
grunt.renameTask('watch', 'observe');
grunt.registerTask('watch', ['default', 'observe']);
};
7 changes: 4 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ app.set('views', config.dirs.views);

app.locals({
site : 'Pure',
copyright_year: '2013',
copyright_year: '2014',

version : config.version,
yui_version: config.yui.version,
Expand All @@ -41,8 +41,9 @@ app.locals({

min: config.isProduction ? '-min' : '',

ga : config.isProduction && config.ga,
typekit: config.typekit
ga : config.isProduction && config.ga,
typekit : config.typekit,
html5shiv: config.html5shiv
});

app.expose(config.yui.config, 'YUI_config');
Expand Down
14 changes: 7 additions & 7 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name" : "pure-site",
"version": "1.8.0",
"private": true,

"dependencies": {
"pure": "latest"
}
"name": "pure-site",
"version": "1.8.0",
"private": true,
"dependencies": {
"pure": "latest",
"rainbow": "~1.1.9"
}
}
11 changes: 6 additions & 5 deletions config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ module.exports = Object.freeze({
port: env.PORT || 5000,

dirs: Object.freeze({
pub : path.resolve('public/'),
pub : path.resolve('build/public/'),
views : path.resolve('views/pages/'),
layouts : path.resolve('views/layouts/'),
partials: path.resolve('views/partials/')
}),

version: require('../package').version,

pure : require('./pure'),
yui : require('./yui'),
ga : 'UA-41480445-1',
typekit: 'gis6vng'
pure : require('./pure'),
yui : require('./yui'),
ga : 'UA-41480445-1',
typekit : 'gis6vng',
html5shiv: '3.7'
});
4 changes: 1 addition & 3 deletions config/pure.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
var fs = require('fs'),
path = require('path');

var bowerrc = path.join(process.cwd(), '.bowerrc'),
bower = JSON.parse(fs.readFileSync(bowerrc, 'utf8')),
bowerPureDir = path.join(process.cwd(), bower.directory, 'pure');
var bowerPureDir = path.resolve('bower_components', 'pure');

exports.version = require(path.join(bowerPureDir, 'bower.json')).version;
exports.modules = ['base', 'grids', 'forms', 'buttons', 'tables', 'menus'];
Expand Down
24 changes: 17 additions & 7 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,15 @@ function code(content, options) {
content = null;
}

var type, open, close;
var type, classes, open, close;

// Determine if this helper is being used as an inline or block helper. When
// `options.fn` is defined this helper was invoked as a block helper.
if (options.fn) {
type = content || 'html';
classes = options.hash.wrap ? 'code code-wrap' : 'code';
content = options.fn(this);
open = '<pre class="snippet" data-language="' + type + '"><code>';
open = '<pre class="' + classes + '" data-language="' + type + '"><code>';
close = '</code></pre>';
} else {
open = '<code>';
Expand Down Expand Up @@ -285,17 +286,26 @@ function setSubTitle(subTitle) {
this.subTitle = subTitle;
}

function fileSize(module, decimals) {
function fileSize(module, decimals, options) {
if (typeof decimals === 'object') {
options = decimals;
decimals = null;
}

typeof decimals === 'number' || (decimals = 1);
var filesize = (this.pure.filesizes[module] / 1024);

var pure = (options && options.hash.pure) || this.pure,
filesize = (pure.filesizes[module] / 1024);

return filesize.toFixed(decimals) + 'KB';
}

function filePercent(module) {
var filesizes = this.pure.filesizes,
function filePercent(module, options) {
var pure = (options && options.hash.pure) || this.pure,
filesizes = pure.filesizes,
total = 0;

total = this.pure.modules.reduce(function (size, module) {
total = pure.modules.reduce(function (size, module) {
return size + filesizes[module];
}, total);

Expand Down
19 changes: 19 additions & 0 deletions lib/tasks/grid-units.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';

var rework = require('rework'),
pureGrids = require('rework-pure-grids');

module.exports = function (grunt) {
grunt.registerMultiTask('grid_units', 'Generates grid units.', function () {
var options = this.options({
indent: ' '
});

this.files.forEach(function (fileGroup) {
var css = rework('').use(pureGrids.units(options.units, options));

grunt.file.write(fileGroup.dest, css.toString(options));
grunt.log.writeln('File "' + fileGroup.dest + '" created.');
});
});
};
107 changes: 58 additions & 49 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,61 @@
{
"name": "pure-site",
"description": "The Pure CSS website.",
"homepage": "http://purecss.io/",
"version": "1.8.2",
"private": true,
"repository": "git://github.com/yui/pure-site.git",
"contributors": [
"Eric Ferraiuolo <eferraiuolo@gmail.com> (http://ericf.me/)",
"Tilo Mitra <tilomitra@gmail.com> (http://www.tilomitra.com/)"
],
"directories": {
"lib": "./lib",
"public": "./public",
"views": "./views"
"name": "pure-site",
"description": "The Pure CSS website.",
"homepage": "http://purecss.io/",
"version": "1.9.0",
"private": true,
"repository": "git://github.com/yui/pure-site.git",
"contributors": [
"Eric Ferraiuolo <eferraiuolo@gmail.com> (http://ericf.me/)",
"Tilo Mitra <tilomitra@gmail.com> (http://www.tilomitra.com/)"
],
"directories": {
"lib": "./lib",
"public": "./public",
"views": "./views"
},
"main": "server.js",
"engines": {
"node": ">=0.8.x",
"npm": ">=1.1.2"
},
"dependencies": {
"combohandler": "~0.2.0",
"express": "3.x",
"express-annotations": "~0.1.0",
"express-params": "~0.0.3",
"express-map": "~0.1.0",
"express-slash": "~0.2.0",
"express-state": "~1.0.1",
"express3-handlebars": "~0.5.0",
"handlebars": "~1.1.2",
"glob": "~3.2.6",
"async": "~0.2.9",
"archiver": "~0.4.10",
"bower": "~1.2.7",
"css-parse": "~1.6.0",
"es6-promise": "~0.1.0",
"rework": "~0.18.3",
"rework-pure-grids": "~0.3.2"
},
"scripts": {
"install": "bower install && grunt"
},
"yahoo": {
"bugzilla": {
"product": "yui utilities",
"component": "Pure"
},
"main": "server.js",
"engines": {
"node": ">=0.8.x",
"npm": ">=1.1.2"
},
"dependencies": {
"combohandler": "~0.2.0",
"express": "3.x",
"express-annotations": "~0.1.0",
"express-params": "~0.0.3",
"express-map": "~0.1.0",
"express-slash": "~0.2.0",
"express-state": "~1.0.1",
"express3-handlebars": "~0.5.0",
"handlebars": "~1.1.2",
"glob": "~3.2.6",
"async": "~0.2.9",
"archiver": "~0.4.10",
"bower": "~1.2.7",
"css-parse": "~1.6.0",
"es6-promise": "~0.1.0"
},
"scripts": {
"install": "bower install"
},
"yahoo": {
"bugzilla": {
"product": "yui utilities",
"component": "Pure"
},
"custodian": {
"email": "tilo@yahoo-inc.com",
"url": "http://purecss.io/"
}
"custodian": {
"email": "tilo@yahoo-inc.com",
"url": "http://purecss.io/"
}
}
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-stripmq": "0.0.3",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-watch": "~0.5.3"
}
}
3 changes: 3 additions & 0 deletions public/css/customize.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
table {
width: 100%;
}

0 comments on commit 2c93b4c

Please sign in to comment.