builds site using Metalsmith

This commit is contained in:
Samuel Ryan 2015-11-06 20:40:58 +00:00
parent 79730d5937
commit 91f610fae7
8 changed files with 167 additions and 0 deletions

22
bower.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "httpstatus.es",
"description": "An easy to reference directory of HTTP Status Codes",
"main": "build.js",
"authors": [
"Samuel Ryan <sam@samryan.co.uk>"
],
"license": "MIT",
"homepage": "https://github.com/citricsquid/httpstatus.es",
"moduleType": [],
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"Skeleton-Sass": "skeleton-scss#*"
}
}

53
build.js Normal file
View File

@ -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!');
});

View File

@ -0,0 +1,17 @@
{
"1": {
"title": "1&times;&times; Informational"
},
"2": {
"title": "2&times;&times; Success"
},
"3": {
"title": "3&times;&times; Redirection"
},
"4": {
"title": "4&times;&times; Client Error"
},
"5": {
"title": "5&times;&times; Server Error"
}
}

34
package.json Normal file
View File

@ -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 <sam@samryan.co.uk>",
"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"
}
}

12
templates/code.jade Normal file
View File

@ -0,0 +1,12 @@
extends layout.jade
block title
title !{code} !{title} &mdash; httpstatus.es
block contents
.code
article.container.code: .row: .twelve.columns
h2 !{groups.codes[set].title}
h1 #[span !{code}] !{title}
!= contents
a(href='/') &larr; Return to httpstatus.es

12
templates/index.jade Normal file
View File

@ -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}]

13
templates/layout.jade Normal file
View File

@ -0,0 +1,13 @@
block title
title #{title} &mdash; 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

4
templates/page.jade Normal file
View File

@ -0,0 +1,4 @@
extends layout.jade
block contents
.hero.introduction: .container: .row: .twelve.columns !{contents}