starkos / industrious-publish

Shared base implementation for the Industrious websites

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Industrious.Publish

A shared base implementation for the websites I build at Industrious One. Built on Eleventy and drawing heavily from Eleventy Excellent and Eleventy Base Blog.

Approach

Rather than a starter site that you clone and edit, this code sits inside your Eleventy project's _includes folder at _includes/base. It doesn't provide any of the top-level files or content, so there's nothing to "undo" when you start a new site, and you can update to the latest version easily without worrying about merge conflicts. Pick and choose which pieces to use and ignore the rest.

Features

I'm adding things as I need them. This is all for my own use so it's all going to be very opinionated, and they are all going to be my opinions.

  • Starter layouts at ./layouts
  • Extended Markdown syntax. Abbreviations, anchors, emoji, footnotes, smart typography for starters; see ./configs/markdown.config.js.
  • Clean, human readable generated markup. I grew up on the early internet learning how it all worked by viewing the source of other people's sites. This is a little effort to pay it forward.

Usage

Starting with an empty project folder add a package.json. Note the reference to the shared code package in devDependencies; we'll satisfy that in a moment.

{
	"name": "my-website",
	"version": "1.0.0",
	"private": true,
	"scripts": {
		"build": "eleventy",
		"watch": "eleventy --watch",
		"serve": "eleventy --serve",
		"start": "eleventy --serve",
		"debug": "DEBUG=* eleventy"
	},
	"devDependencies": {
		"base": "file:./src/_includes/base"
	}
}

While you're there, add an eleventy.config.js as well, and use it to pull in the shared configuration.

const base = require('./src/_includes/base/configs/base.config.js')

module.exports = eleventyConfig => {
	return base(eleventyConfig);
};

Create a skeleton site.

$ mkdir src src/_data src/_includes
$ echo '# Welcome to My Site' > src/index.md

When I'm building my own sites I pull in this base code as a Git submodule located at src/_includes/base. That allows me to easily add fixes and features to the base while building out the downstream sites, and not bother with hosting NPM modules. You could also submodule your own fork of it, or just copy the code to that same location.

$ git submodule add \
  https://github.com/starkos/industrious-publish \
  src/_includes/base

Finally, copy base/samples/metadata-sample.js to src/_data/metadata.js and edit to suit. Then npm install && npm start and http://localhost:8080/ and you're off to the races.

Examples

Here are some sites I'm in the process of building on this code. If you use it for a project of your own, and would like a link here, just submit a PR with the change.

References

About

Shared base implementation for the Industrious websites

License:BSD 3-Clause Clear License


Languages

Language:JavaScript 39.6%Language:CSS 37.4%Language:Nunjucks 23.0%