Initial commit

This commit is contained in:
Simon Martens
2022-12-30 16:29:30 +01:00
committed by GitHub
commit 7bef8581b0
14 changed files with 3847 additions and 0 deletions

20
.eleventy.js Normal file
View File

@@ -0,0 +1,20 @@
module.exports = function (config) {
// Set static folder, which copntent will be copied to the output folder
config.addPassthroughCopy({ "src/static/": "/" });
return {
// Set custom directories for dynamic pages, data, includes, layouts and finally the generated output
dir:
{
input: "src/dynamic",
layouts: "../layouts",
includes: "../includes",
data: "../data",
output: "dist"
},
// Set template formats so that other files won't be included in dist
templateFormats: ["njk", "md", "html"]
};
};

107
.gitignore vendored Normal file
View File

@@ -0,0 +1,107 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# 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
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Eleventy output file
dist/

49
README.md Normal file
View File

@@ -0,0 +1,49 @@
# 11ty Sane Config Template
This a template providing a sane base config for eleventy, mainly for the purpose of mainiaining a clear and separated folder structure, plus providing autoprefixer for some level of CSS processing and tailwindcss as a default css framework. The settings are as follows:
## Directory structure
```
.\.eleventy.js
```
| Path | Description |
| ---- | ------------ |
| `src/` | Source for the Page |
| `dist/` | (Auto-Generated) Output Directory |
| `src/data/` | Contains data files |
| `src/includes/` | Contains Includes |
| `src/layouts/` | Contains Layouts |
| `src/dynamic/` | Contains Templates |
| `src/static/` | Contains static assets, contents get copied on build time |
## (Development) Dependencies
```
.\package.json
.\postcss.config.js
```
| Packet | Description |
| ----- | ------------ |
| `@11ty/eleventy@2.0.0-canary` | SSG base package |
| `postcss(-cli)` | For pre- and postprocessing of CSS |
| `autoprefixer` | Provides some cross-browser-functionality |
| `cssnano` | Minimizes CSS Filesize |
| `tailwindcss@3.2.4` | CSS-Framework |
## Commands
```
.\package.json
```
| Command | Description |
| ------- | ----------- |
| `npm run watch` | Run dev server in watch mode |
| `npm run css_watch` | Watch for CSS changes & rebuild |
| `npm run build` | First build the CSS, then the site |
## Other Settings
```
.\.eleventy.js
```
This will parse `.njk`, `.html` and `.md` templates by default.
```
.\src\data\config.json
```
These are some configuration options for default title displayed in the title bar, some SEO, and some options for sharing on social media. The `base.njk`-Layout configures these as default, unless front matter is provided on the specific template.

3551
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

35
package.json Normal file
View File

@@ -0,0 +1,35 @@
{
"name": "eleventy-sane",
"version": "1.0.0",
"description": "Sane default template for 11ty. Breaks with 11ty's \"no-setup\" approach for a clearer folder structure.",
"main": "index.js",
"scripts": {
"build": "(npx postcss src/static/css/site.css -o src/static/css/output.css; npx @11ty/eleventy)",
"watch": "npx @11ty/eleventy --serve",
"css_watch": "npx postcss src/static/css/site.css -o src/static/css/output.css -w --verbose"
},
"repository": {
"type": "git",
"url": "git+https://github.com/schnulller/eleventy-sane.git"
},
"keywords": [
"11ty",
"eleventy",
"template",
"defaults"
],
"author": "Simon Martens",
"license": "MIT",
"bugs": {
"url": "https://github.com/schnulller/eleventy-sane/issues"
},
"homepage": "https://github.com/schnulller/eleventy-sane#readme",
"dependencies": {
"@11ty/eleventy": "^2.0.0-canary.23",
"autoprefixer": "^10.4.13",
"cssnano": "^5.1.14",
"postcss": "^8.4.20",
"postcss-cli": "^10.1.0",
"tailwindcss": "^3.2.4"
}
}

8
postcss.config.js Normal file
View File

@@ -0,0 +1,8 @@
module.exports = {
plugins: [
require('tailwindcss'),
// Production:
require('autoprefixer'),
require('cssnano')({ preset: 'default' })
],
}

10
src/data/config.json Normal file
View File

@@ -0,0 +1,10 @@
{
"title": "SITE DEFAULT TITLE",
"url": "URL",
"description": "Description used for SSO if template provides none.",
"keywords": "Keywords. Used for SSO.",
"image": "Default Image. Used for sharing on social media if no image is provided.",
"twitter": "@Twitter_Handle",
"card": "summary"
}

4
src/dynamic/index.md Normal file
View File

@@ -0,0 +1,4 @@
---
title: Home
layout: base
---

0
src/includes/footer.njk Normal file
View File

0
src/includes/header.njk Normal file
View File

51
src/layouts/base.njk Normal file
View File

@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<link rel="canonical" href="{{ config.url }}{{ page.url }}">
<link rel="stylesheet" href="/css/output.css" >
<title>{% if title and title != 'Home' %}{{title}} - {% endif %}{{ config.title }}</title>
<!-- Icons -->
<!-- Enable if favicons installed into the static/img/ directory -->
{# <link rel="shortcut icon" type="image/png" href="/images/x16-favicon.png" sizes="16x16" />
<link rel="shortcut icon" type="image/png" href="/images/x32-favicon.png" sizes="32x32" />
<link rel="shortcut icon" type="image/png" href="/images/x64-favicon.png" sizes="64x64" />
<link rel="shortcut icon" type="image/png" href="/images/x256-favicon.png" sizes="256x256" />
<link rel="apple-touch-icon" type="image/png" href="/images/x256-favicon.png" /> #}
<!-- Meta -->
<meta name="description" content="{% if description %}{{ description }}{% else %}{{ config.description }}{% endif %}">
<meta name="keywords" content="{% if keywords %}{{ keywords }}{% else %}{{ config.keywords }}{% endif %}">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Language" content="en">
<meta name="viewport" content="width=device-width,initial-scale=1">
<!-- Facebook -->
<meta property="og:title" content="{% if (title != 'Home') %}{{title}} - {% endif %}{{ config.title }}">
<meta property="og:type" content="website">
<meta property="og:description" content="{% if description %}{{ description }}{% else %}{{ config.description }}{% endif %}">
<meta property="og:url" content="{{ config.url }}{{ page.url }}">
<meta property="og:image" content="{% if image %}{{ image }}{% else %}{{ config.image }}{% endif %}">
<!-- Twitter -->
<meta name="twitter:card" content="{{ card }}">
<meta name="twitter:site" content="{{ twitter }}">
<meta name="twitter:title" content="{% if (title != 'Home') %}{{title}} - {% endif %}{{ config.title }}">
<meta name="twitter:description" content="{% if description %}{{ description }}{% else %}{{ config.description }}{% endif %}">
<meta name="twitter:creator" content="{{ twitter }}">
<meta name="twitter:image" content="{{ config.url }}{{ page.url }}">
<meta name="twitter:domain" content="{% if image %}{{ image }}{% else %}{{ config.image }}{% endif %}">
</head>
<body>
{% include "header.njk" %}
<main>
{{ content | safe }}
</main>
{% include "footer.njk" %}
</body>
</html>

View File

@@ -0,0 +1 @@
/*! tailwindcss v3.2.4 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }

3
src/static/css/site.css Normal file
View File

@@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

8
tailwind.config.js Normal file
View File

@@ -0,0 +1,8 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{html,js,njk,yml,md}"],
theme: {
extend: {},
},
plugins: [],
}