diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..578f7bd --- /dev/null +++ b/bower.json @@ -0,0 +1,22 @@ +{ + "name": "httpstatus.es", + "description": "An easy to reference directory of HTTP Status Codes", + "main": "build.js", + "authors": [ + "Samuel Ryan " + ], + "license": "MIT", + "homepage": "https://github.com/citricsquid/httpstatus.es", + "moduleType": [], + "private": true, + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "Skeleton-Sass": "skeleton-scss#*" + } +} diff --git a/build.js b/build.js new file mode 100644 index 0000000..f0a360b --- /dev/null +++ b/build.js @@ -0,0 +1,53 @@ +var Metalsmith = require('metalsmith'); +var markdown = require('metalsmith-markdown'); +var collections = require('metalsmith-collections'); +var layouts = require('metalsmith-layouts'); +var branch = require('metalsmith-branch'); +var sass = require('metalsmith-sass'); +var elevate = require('metalsmith-elevate'); +var ignore = require('metalsmith-ignore'); +var collectionGrouping = require('metalsmith-collection-grouping'); + +var metalsmith = Metalsmith(__dirname); + metalsmith + .source('contents') + .destination('build') + + .use(collections({ + pages: { + pattern: '*.md' + }, + codes: { + pattern: 'codes/*.md', + sortBy: 'code' + } + })) + + .use(collectionGrouping({ + codes: { + groupBy: 'set', // set instead of class, because class is a reserved word... + meta: 'codes/classes.json' + } + })) + + .use(branch('*.scss') + .use(sass()) + ) + + .use(branch('**/*.md') + .use(markdown()) + .use(layouts({ + engine: 'jade', + directory: 'templates', + default: 'code.jade', + pretty: true + })) + ) + + .use(elevate('codes/*.html')) + .use(ignore('**/*.json')) + + .build(function (err) { + if (err) throw err; + console.log('Build successful!'); + }); \ No newline at end of file diff --git a/contents/codes/classes.json b/contents/codes/classes.json new file mode 100644 index 0000000..ab6648b --- /dev/null +++ b/contents/codes/classes.json @@ -0,0 +1,17 @@ +{ + "1": { + "title": "1×× Informational" + }, + "2": { + "title": "2×× Success" + }, + "3": { + "title": "3×× Redirection" + }, + "4": { + "title": "4×× Client Error" + }, + "5": { + "title": "5×× Server Error" + } +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..eff7ed3 --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "httpstatus.es", + "version": "0.1.0", + "description": "An easy to reference directory of HTTP Status Codes", + "main": "build.js", + "scripts": { + "test": "build.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/citricsquid/httpstatus.es.git" + }, + "author": "Samuel Ryan ", + "license": "MIT", + "bugs": { + "url": "https://github.com/citricsquid/httpstatus.es/issues" + }, + "homepage": "https://github.com/citricsquid/httpstatus.es#readme", + "dependencies": { + "bower": "^1.6.5", + "jade": "^1.11.0", + "lodash.groupby": "^3.1.1", + "metalsmith": "^2.1.0", + "metalsmith-branch": "0.0.4", + "metalsmith-collection-grouping": "^0.1.0", + "metalsmith-collections": "^0.7.0", + "metalsmith-elevate": "0.0.0", + "metalsmith-ignore": "^0.1.2", + "metalsmith-layouts": "^1.4.2", + "metalsmith-markdown": "^0.2.1", + "metalsmith-sass": "^1.3.0", + "metalsmith-writemetadata": "^0.4.5" + } +} diff --git a/templates/code.jade b/templates/code.jade new file mode 100644 index 0000000..dcc71ec --- /dev/null +++ b/templates/code.jade @@ -0,0 +1,12 @@ +extends layout.jade + +block title + title !{code} !{title} — httpstatus.es + +block contents + .code + article.container.code: .row: .twelve.columns + h2 !{groups.codes[set].title} + h1 #[span !{code}] !{title} + != contents + a(href='/') ← Return to httpstatus.es \ No newline at end of file diff --git a/templates/index.jade b/templates/index.jade new file mode 100644 index 0000000..094d728 --- /dev/null +++ b/templates/index.jade @@ -0,0 +1,12 @@ +extends layout.jade + +block contents + .hero.introduction: .container: .row: .twelve.columns !{contents} + + .container.codes + each group in groups.codes + section + h2 !{group.title} + each code in group.items + article + h3 #[a(href='/#{code.code}') #[span !{code.code}] #{code.title}] \ No newline at end of file diff --git a/templates/layout.jade b/templates/layout.jade new file mode 100644 index 0000000..22f3a25 --- /dev/null +++ b/templates/layout.jade @@ -0,0 +1,13 @@ +block title + title #{title} — httpstatus.es + +doctype html +html(lang="en") + head + block title + // link(rel='shortcut icon', href='/favicon.ico', type='image/x-icon') + link(rel='stylesheet', href='/style.css') + link(rel='stylesheet', href='https://fonts.googleapis.com/css?family=Montserrat|Open+Sans|Source+Code+Pro:700', type='text/css') + meta(name='viewport', content='width=device-width, initial-scale=1.0') + body + block contents \ No newline at end of file diff --git a/templates/page.jade b/templates/page.jade new file mode 100644 index 0000000..bc03bc3 --- /dev/null +++ b/templates/page.jade @@ -0,0 +1,4 @@ +extends layout.jade + +block contents + .hero.introduction: .container: .row: .twelve.columns !{contents} \ No newline at end of file