mirror of
https://github.com/rmaake1/httpstatuses.git
synced 2024-10-04 15:17:23 +02:00
builds site using Metalsmith
This commit is contained in:
parent
79730d5937
commit
91f610fae7
22
bower.json
Normal file
22
bower.json
Normal 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
53
build.js
Normal 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!');
|
||||
});
|
17
contents/codes/classes.json
Normal file
17
contents/codes/classes.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
34
package.json
Normal file
34
package.json
Normal 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
12
templates/code.jade
Normal file
@ -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
|
12
templates/index.jade
Normal file
12
templates/index.jade
Normal 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
13
templates/layout.jade
Normal file
@ -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
|
4
templates/page.jade
Normal file
4
templates/page.jade
Normal file
@ -0,0 +1,4 @@
|
||||
extends layout.jade
|
||||
|
||||
block contents
|
||||
.hero.introduction: .container: .row: .twelve.columns !{contents}
|
Loading…
Reference in New Issue
Block a user