├── .gitignore
├── _components
└── hello-component.webc
├── content
├── content.11tydata.js
├── page.webc
└── index.webc
├── .editorconfig
├── _data
└── metadata.js
├── _includes
└── layouts
│ ├── css
│ └── base.css
│ └── base.webc
├── eleventy.config.js
├── LICENSE
├── package.json
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | _site
3 | package-lock.json
--------------------------------------------------------------------------------
/_components/hello-component.webc:
--------------------------------------------------------------------------------
1 |
Hello .
2 |
--------------------------------------------------------------------------------
/content/content.11tydata.js:
--------------------------------------------------------------------------------
1 | export default {
2 | // Set a global layout for all templates in this folder.
3 | layout: "layouts/base.webc",
4 | };
5 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = tab
5 | indent_size = 2
6 | end_of_line = lf
7 | insert_final_newline = true
8 | trim_trailing_whitespace = true
9 | charset = utf-8
10 |
--------------------------------------------------------------------------------
/content/page.webc:
--------------------------------------------------------------------------------
1 | ---js
2 | function permalink(data) {
3 | return "/remapped/";
4 | }
5 | ---
6 | This is another page.
7 |
8 |
9 |
10 | Go back.
11 |
--------------------------------------------------------------------------------
/_data/metadata.js:
--------------------------------------------------------------------------------
1 | import { createRequire } from 'node:module';
2 |
3 | const require = createRequire(import.meta.url);
4 | const pkg = require("../package.json");
5 |
6 | export default {
7 | // Feel free to override these, they are pulling from package.json for default values.
8 | title: "Eleventy Base WebC" || pkg.name,
9 | description: "" || pkg.description,
10 | language: "en",
11 | };
12 |
--------------------------------------------------------------------------------
/content/index.webc:
--------------------------------------------------------------------------------
1 | ---js
2 | // Initialize page data in JavaScript front matter
3 | let place = "earth";
4 | ---
5 |
6 |
7 |
8 | Another page.
9 |
10 |
11 |
16 |
--------------------------------------------------------------------------------
/_includes/layouts/css/base.css:
--------------------------------------------------------------------------------
1 | :root {
2 | --font-family: system-ui, sans-serif;
3 |
4 | --background-color: #fff;
5 | --text-color: #333;
6 | --text-color-link: #082840;
7 | --text-color-link-active: #5f2b48;
8 | --text-color-link-visited: #17050F;
9 | }
10 |
11 | /* Global stylesheet */
12 | * {
13 | box-sizing: border-box;
14 | }
15 | html,
16 | body {
17 | padding: 0;
18 | margin: 0 auto;
19 | font-family: var(--font-family);
20 | color: var(--text-color);
21 | background-color: var(--background-color);
22 | }
23 | html {
24 | overflow-y: scroll;
25 | }
26 | header,
27 | main,
28 | footer {
29 | padding: .5rem;
30 | margin: 0 auto;
31 | max-width: 60rem;
32 | }
33 | footer {
34 | font-style: italic;
35 | font-size: 0.9375em; /* 15px /16 */
36 | }
37 |
--------------------------------------------------------------------------------
/eleventy.config.js:
--------------------------------------------------------------------------------
1 | import pluginWebc from "@11ty/eleventy-plugin-webc";
2 | import { InputPathToUrlTransformPlugin } from "@11ty/eleventy";
3 |
4 | /** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */
5 | export default function(eleventyConfig) {
6 | eleventyConfig.ignores.add("README.md");
7 |
8 | eleventyConfig.addPlugin(pluginWebc, {
9 | components: [
10 | "./_components/**/*.webc",
11 | "npm:@11ty/is-land/*.webc"
12 | ]
13 | });
14 |
15 | eleventyConfig.addPlugin(InputPathToUrlTransformPlugin);
16 |
17 | eleventyConfig.setServerOptions({
18 | domDiff: false
19 | });
20 | };
21 |
22 | export const config = {
23 | dir: {
24 | input: "content", // default: "."
25 | includes: "../_includes", // default: "_includes"
26 | data: "../_data", // default: "_data"
27 | }
28 | };
29 |
--------------------------------------------------------------------------------
/_includes/layouts/base.webc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
19 |
20 |
21 |
22 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Zach Leatherman @zachleat
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@11ty/eleventy-base-webc",
3 | "version": "1.0.0",
4 | "description": "A minimalist bare-bones starter project using Eleventy and WebC.",
5 | "type": "module",
6 | "scripts": {
7 | "build": "npx @11ty/eleventy",
8 | "start": "npx @11ty/eleventy --serve --quiet --incremental",
9 | "debug": "DEBUG=Eleventy* npx @11ty/eleventy",
10 | "benchmark": "DEBUG=Eleventy:Benchmark* npx @11ty/eleventy"
11 | },
12 | "repository": {
13 | "type": "git",
14 | "url": "git://github.com/11ty/eleventy-base-webc.git"
15 | },
16 | "author": {
17 | "name": "Zach Leatherman",
18 | "email": "zachleatherman@gmail.com",
19 | "url": "https://zachleat.com/"
20 | },
21 | "license": "MIT",
22 | "engines": {
23 | "node": ">=18"
24 | },
25 | "funding": {
26 | "type": "opencollective",
27 | "url": "https://opencollective.com/11ty"
28 | },
29 | "bugs": {
30 | "url": "https://github.com/11ty/eleventy-base-webc/issues"
31 | },
32 | "homepage": "https://github.com/11ty/eleventy-base-webc#readme",
33 | "devDependencies": {
34 | "@11ty/eleventy": "^3.0.0",
35 | "@11ty/eleventy-plugin-webc": "^0.11.2"
36 | },
37 | "dependencies": {
38 | "@11ty/is-land": "^4.0.0"
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # eleventy-base-webc
2 |
3 | A minimalist bare-bones Eleventy-official starter project useful for demos/experiments with [WebC](https://www.11ty.dev/docs/languages/webc/) and the [Eleventy](https://www.11ty.dev/) site generator (using the [v3.0 release](https://www.11ty.dev/blog/canary-eleventy-v3/)).
4 |
5 | ## Features
6 |
7 | * [Eleventy WebC plugin](https://www.11ty.dev/docs/languages/webc/) preconfigured:
8 | * Includes the [`` WebC component](https://www.11ty.dev/docs/plugins/partial-hydration/) ready for use.
9 | * Add your own `*.webc` files to the `_components` folder.
10 | * Using the new [`js` front matter type for arbitrary JavaScript front matter](https://www.11ty.dev/docs/data-frontmatter/#javascript-front-matter)
11 | * Simple WebC Eleventy Layout file with streamlined critical CSS and JS bundles (see `_includes/layouts/base.webc`)
12 |
13 | ## Get Started
14 |
15 | 1. Make a copy of this code with **one** of these on the command line (both install into the current folder):
16 | * `git clone https://github.com/11ty/eleventy-base-webc.git .`
17 | * `npx degit 11ty/eleventy-base-webc`
18 | * …or you can use the [_"Use this template"_ button on GitHub](https://github.com/11ty/eleventy-base-webc).
19 | 2. Install the dependencies by running `npm install`
20 | 3. Run it with `npm start` (see the other commands in `package.json` or on the [CLI docs](https://www.11ty.dev/docs/usage/))
21 | 4. Navigate to `http://localhost:8080` in your web browser.
22 | 5. Edit `content/index.webc` to change content on the home page.
23 |
24 | ## Demo
25 |
26 | - [Cloudflare Pages](https://eleventy-base-webc.pages.dev/)
27 | - [Netlify](https://eleventy-base-webc.netlify.app/)
28 | - Learn more about [deploying an Eleventy project to the web](https://www.11ty.dev/docs/deployment/).
29 |
--------------------------------------------------------------------------------