Skip to content

Commit

Permalink
convert to 11ty
Browse files Browse the repository at this point in the history
  • Loading branch information
Alec Marcus committed Feb 5, 2021
1 parent afeafa2 commit 68587a0
Show file tree
Hide file tree
Showing 137 changed files with 15,593 additions and 11,030 deletions.
109 changes: 109 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
const fs = require('fs');
const pluginSyntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
const pluginNavigation = require('@11ty/eleventy-navigation');
const markdownIt = require('markdown-it');
const markdownItAnchor = require('markdown-it-anchor');
const {
// getSlugMap,
getSortedCollection,
// getTagList
} = require('./src/_11ty/collections');
const {
htmlDateString,
// includesSolution,
// includesTeam,
// includesTechnology,
readableDate,
// sortCollectionByTitle,
} = require('./src/_11ty/filters');

require('dotenv').config({ path: `.env.${process.env.NODE_ENV || 'development'}` });

// https://www.11ty.dev/docs/config/
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(pluginSyntaxHighlight);
eleventyConfig.addPlugin(pluginNavigation);

/* Markdown Overrides */
let markdownLibrary = markdownIt({
html: true,
breaks: true,
linkify: true,
}).use(markdownItAnchor, {
permalink: true,
permalinkClass: 'direct-link',
permalinkSymbol: '#',
});
eleventyConfig.setLibrary('md', markdownLibrary);

eleventyConfig.setDataDeepMerge(true);
eleventyConfig.setUseGitIgnore(false);

// For rendering JSON API routes
eleventyConfig.addJavaScriptFunction('renderApi', data => JSON.stringify(data, null, '\t'));

/**
* Add custom collections
*
* @see https://www.11ty.dev/docs/collections/#advanced-custom-filtering-and-sorting
*/
eleventyConfig.addCollection('sortedEntries', collectionApi =>
getSortedCollection(collectionApi, 'entries'),
);

/**
* Add custom filters
*
* @see https://www.11ty.dev/docs/filters/
*/
eleventyConfig.addFilter('htmlDateString', htmlDateString);
eleventyConfig.addFilter('readableDate', readableDate);
// eleventyConfig.addFilter('includesSolution', includesSolution);
// eleventyConfig.addFilter('includesTeam', includesTeam);
// eleventyConfig.addFilter('includesTechnology', includesTechnology);
// eleventyConfig.addFilter('sortCollectionByTitle', sortCollectionByTitle);

/**
* Add custom watch targets
*
* @see https://www.11ty.dev/docs/config/#add-your-own-watch-targets
*/
eleventyConfig.addWatchTarget('./bundle/');
eleventyConfig.addWatchTarget('./src/assets/styles/');
eleventyConfig.addWatchTarget('./src/pages/');

/**
* Copy directories to _site
*
* @see https://www.11ty.dev/docs/copy/#passthrough-file-copy
*/
eleventyConfig.addPassthroughCopy('src/static/img');
eleventyConfig.addPassthroughCopy('src/static/fonts');
eleventyConfig.addPassthroughCopy({ bundle: 'assets/scripts' });

// Browsersync Overrides
eleventyConfig.setBrowserSyncConfig({
callbacks: {
ready: function (err, browserSync) {
const content_404 = fs.readFileSync('_site/404.html');

browserSync.addMiddleware('*', (req, res) => {
// Provides the 404 content without redirect.
res.write(content_404);
res.end();
});
},
},
ui: false,
ghostMode: false,
});

return {
templateFormats: ['md', 'njk', 'html', 'liquid', '11ty.js'],

// These are all optional, defaults are shown:
dir: {
input: 'src',
},
};
};
2 changes: 2 additions & 0 deletions .eleventyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
README.md
src/_11ty/
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The URL of the host site
SITE_URL="http://localhost:8080"
9 changes: 8 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"extends": "@upstatement/eslint-config/vue"
"extends": "@upstatement",
"parserOptions": {
"sourceType": "module"
},
"env": {
"browser": true,
"node": true
}
}
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Bug Report
about: If something is broken or not working as expected, report it here.
---

# Description

Describe the issue that you're seeing.

## Steps to reproduce

Clear steps describing how to reproduce the issue.

## Expected result

What should happen?

## Actual result

What happened.

## Environment

- OS:
- Browser & version:
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Feature Request
about: Suggest a new idea for the project.
---

# Summary

Brief explanation of the feature.

## Basic example

If the proposal involves a new or changed API, include a basic code example. Omit this section if it's not applicable.

## Motivation

Why are we doing this? What use cases does it support? What is the expected outcome?
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Question
about: Usage question or discussion
---

# Summary

## Relevant information

<!-- Provide as much useful information as you can -->

### Environment (if relevant)
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Changes

<!-- Detail your changes here -->

<!-- Add an image of expected results, if relevant -->

## Steps To Test

<!-- npm install? -->
72 changes: 6 additions & 66 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,71 +1,11 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
/sitespeed-result

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
_site/
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz
.DS_Store
.cache
bundle

# dotenv environment variable files
# Environment variables
.env
.env.local
.env.development
.env.production

# gatsby files
.cache/

# Mac files
.DS_Store

# Yarn
yarn-error.log
.pnp/
.pnp.js
# Yarn Integrity file
.yarn-integrity
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.13.1
v12.16.2
23 changes: 23 additions & 0 deletions .temples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
entry:
temples:
- template: ./templates/entry.template
output: ./src/entries/{{ kebab name }}.md
prompt:
- key: name
doc: Entry name

collection:
temples:
- template: ./templates/collection.template
output: ./src/collections/{{ kebab name }}.md
prompt:
- key: name
doc: Collection name

series:
temples:
- template: ./templates/series.template
output: ./src/series/{{ kebab name }}.md
prompt:
- key: name
doc: Series name
Loading

0 comments on commit 68587a0

Please sign in to comment.