Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nunjucksification #34

Merged
merged 3 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,19 @@
const handlebarsPlugin = require("@11ty/eleventy-plugin-handlebars");

module.exports = async function(eleventyConfig) {
eleventyConfig.addPlugin(handlebarsPlugin);

// Add a filter using the Config API
// eleventyConfig.addFilter( "myFilter", function() {});

// Universal Shortcodes (Adds to Liquid, Nunjucks, Handlebars)
eleventyConfig.addShortcode("whichPartial", function(data) {
console.dir(data);
return `${data}`;
eleventyConfig.addShortcode("assetDepth", function() {
const fileName = this.page.filePathStem.split('/').pop();
return (fileName === 'index') ? '.' : '..';
});

// Copy assets.
eleventyConfig.addPassthroughCopy("src/site/images");
eleventyConfig.addPassthroughCopy("src/site/assets");
eleventyConfig.addPassthroughCopy("src/site/**/*.css");
eleventyConfig.addPassthroughCopy("src/site/**/*.js");
eleventyConfig.addPassthroughCopy({
"src/site/favico": "/"
});

// Need to manually add watch targets? The CSS wasn't actually
// copying/reloading without this.
// TODO: Maybe instead of having 11ty copy assets into place, I should just
// have my watch process do it, instead?
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.addWatchTarget("src/site/assets");

// Return Config object.
return {
dir: {
Expand Down
120 changes: 1 addition & 119 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"@11ty/eleventy": "^3.0.0",
"@11ty/eleventy-plugin-handlebars": "^1.0.0"
"@11ty/eleventy": "^3.0.0"
}
}
9 changes: 0 additions & 9 deletions src/site/_includes/bottombar.hbs

This file was deleted.

5 changes: 5 additions & 0 deletions src/site/_includes/bottombar.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- Bottom Bar -->

<div id="bottombar">
<p>a <a href="https://namingthingsishard.blog/">Naming Things Is Hard</a> thing</p>
</div>
15 changes: 15 additions & 0 deletions src/site/_includes/end.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script src="/assets/js/core/core.js" type="module"></script>

{% if scripts %}
<!-- Custom scripts -->
{% for script in scripts %}
<script src="/assets/js/{{ script }}" type="module"></script>
{% endfor %}
{% endif %}

{% if lscripts %}
<!-- Custom local stylesheets -->
{% for script in lscripts %}
<script src="{% assetDepth %}/assets/{{ script }}" type="module"></script>
{% endfor %}
{% endif %}
5 changes: 0 additions & 5 deletions src/site/_includes/footer-contents.hbs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,23 @@
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{!-- Icons --}}
{# Icons #}
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">

{{!--
<!-- Google Font: Titillium -->
<link href='https://fonts.googleapis.com/css?family=Titillium+Web:400,200,200italic,300,300italic,400italic,600,600italic,700,900,700italic' rel='stylesheet' type='text/css'>
--}}

{{!-- Stylesheets --}}
<!-- Main stylesheet -->
{# Stylesheets #}
<link rel="stylesheet" href="/assets/css/core/core.css">

{{#if styles}}
<!-- Custom stylesheets -->
{{#each styles}}
<link rel="stylesheet" href="/assets/css/{{ this }}">
{{/each}}
{{/if}}
{% if styles %}
{% for sheet in styles %}
<link rel="stylesheet" href="/assets/css/{{ sheet }}">
{% endfor %}
{% endif %}

{% if lstyles %}
{% for sheet in lstyles %}
<link rel="stylesheet" href="{% assetDepth %}/assets/{{ sheet }}">
{% endfor %}
{% endif %}
9 changes: 0 additions & 9 deletions src/site/_includes/topbar.hbs

This file was deleted.

5 changes: 5 additions & 0 deletions src/site/_includes/topbar.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- Top Bar -->

<div id="topbar">
<p>Welcome to a Next Page project</p>
</div>
22 changes: 22 additions & 0 deletions src/site/_layouts/base.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<html class="no-js" lang="en">
<head>
{% block head %}
{% include "head.njk" %}
{% endblock %}
</head>

<body>
{% block header %}{% endblock %}

{% block content %}
{{ content | safe }}
{% endblock %}

{% block footer %}{% endblock %}

{% block end %}
{% include "end.njk" %}
{% endblock %}
</body>
</html>
14 changes: 0 additions & 14 deletions src/site/_layouts/main.hbs

This file was deleted.

Loading