Skip to content

Commit 686b7cc

Browse files
committed
first commit
0 parents  commit 686b7cc

26 files changed

+30585
-0
lines changed

.editorconfig

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
end_of_line = lf
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
indent_style = space
10+
indent_size = 2
11+
12+
[*.{yaml,.yml}]
13+
indent_size = 2
14+
15+
[*.md]
16+
trim_trailing_whitespace = false
17+
18+
[Makefile]
19+
indent_style = tab

.eleventy.js

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
const markdownIt = require("markdown-it")
2+
const htmlmin = require("html-minifier")
3+
const path = require('path')
4+
const fs = require('fs')
5+
6+
const isProduction = process.env.NODE_ENV === 'production'
7+
const slugify = require('slugify')
8+
const { fstat } = require("fs")
9+
const slugify_opts = {
10+
strict: true,
11+
}
12+
13+
14+
module.exports = function(eleventyConfig) {
15+
// Static Syntax Highlighting Plugin
16+
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
17+
eleventyConfig.addPlugin(syntaxHighlight);
18+
19+
eleventyConfig.addPassthroughCopy("src/static");
20+
21+
eleventyConfig.markdownTemplateEngine = 'njk'
22+
//eleventyConfig.markdownTemplateEngine = 'liquid'
23+
24+
eleventyConfig.dir = {
25+
input: './src',
26+
output: "./public"
27+
}
28+
29+
eleventyConfig.setDataDeepMerge(true)
30+
31+
eleventyConfig.setTemplateFormats([
32+
'njk',
33+
'md',
34+
'jpg',
35+
'png',
36+
'js',
37+
'csv',
38+
'html',
39+
'css',
40+
// 'svg',
41+
// 'liquid',
42+
// 'pug',
43+
// 'ejs',
44+
// 'hbs',
45+
// 'mustache',
46+
// 'haml',
47+
// '11ty.js',
48+
])
49+
50+
const markdownItOptions = {
51+
html: true,
52+
breaks: true,
53+
linkify: true
54+
}
55+
56+
md_lib = markdownIt(markdownItOptions)
57+
.disable('code')
58+
.use(require('markdown-it-attrs'))
59+
.use(require('markdown-it-anchor'), {
60+
slugify: (s) => slugify(s, slugify_opts)
61+
})
62+
63+
64+
eleventyConfig.setLibrary("md", md_lib)
65+
66+
eleventyConfig.addTransform("htmlmin", function(content, outputPath) {
67+
if(isProduction && outputPath.endsWith(".html")){
68+
let minified = htmlmin.minify(content, {
69+
useShortDoctype: true,
70+
removeComments: true,
71+
collapseWhitespace: true
72+
})
73+
74+
return minified
75+
}
76+
77+
return content
78+
})
79+
80+
eleventyConfig.addFilter("slugify", (content) => {
81+
return slugify(content, slugify_opts);
82+
});
83+
84+
eleventyConfig.addShortcode("include_relative", function (relPath) {
85+
let dir = path.dirname(this.page.inputPath);
86+
let fulLPath = path.join(dir, relPath);
87+
return `<div>${fs.readFileSync(fulLPath)}</div>`;
88+
});
89+
90+
return eleventyConfig
91+
}

.eleventyignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Ignore files and folders that start with '__'
2+
**/__*
3+
**/__*/*
4+
src/static/**

.github/workflows/main.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Deploy 11ty `main` on /dev
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
# `npm` stuff:
19+
- uses: actions/cache@v2
20+
env:
21+
cache-name: cache-node-modules
22+
with:
23+
path: ~/.npm
24+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
25+
restore-keys: |
26+
${{ runner.os }}-build-${{ env.cache-name }}-
27+
${{ runner.os }}-build-
28+
${{ runner.os }}-
29+
30+
- run: npm install
31+
32+
- run: npm run build
33+
34+
# Deploy to web server:
35+
- uses: shimataro/ssh-key-action@v2
36+
with:
37+
key: ${{ secrets.DEPLOY_KEY }}
38+
known_hosts: ${{ secrets.KNOWN_HOSTS }}
39+
40+
- run: |
41+
rsync -rtvzi ${{ github.workspace }}/public/ ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:${{ secrets.DEPLOY_PATH }}/dev
42+

.github/workflows/prod.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy 11ty `prod` as production
2+
3+
on:
4+
push:
5+
branches: [ prod ]
6+
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
branches: [ prod ]
10+
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
# `npm` stuff:
20+
- uses: actions/cache@v2
21+
env:
22+
cache-name: cache-node-modules
23+
with:
24+
path: ~/.npm
25+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
26+
restore-keys: |
27+
${{ runner.os }}-build-${{ env.cache-name }}-
28+
${{ runner.os }}-build-
29+
${{ runner.os }}-
30+
31+
- run: npm install
32+
33+
- run: npm run build
34+
35+
# Deploy to web server:
36+
- uses: shimataro/ssh-key-action@v2
37+
with:
38+
key: ${{ secrets.DEPLOY_KEY }}
39+
known_hosts: ${{ secrets.KNOWN_HOSTS }}
40+
41+
- run: |
42+
rsync -rtvzi ${{ github.workspace }}/public/ ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:${{ secrets.DEPLOY_PATH }}
43+

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.parcel-cache/
2+
public/
3+
node_modules/
4+
.DS_Store
5+
.vscode

0 commit comments

Comments
 (0)