Skip to content

Commit

Permalink
switch to astro
Browse files Browse the repository at this point in the history
  • Loading branch information
matkat99 committed Jul 11, 2024
1 parent c57ee17 commit 8901d4c
Show file tree
Hide file tree
Showing 210 changed files with 6,937 additions and 124 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy to GitHub Pages

on:
# Trigger the workflow every time you push to the `main` branch
# Using a different branch name? Replace `main` with your branch’s name
push:
branches: [main]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:

# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4
- name: Install, build, and upload your site
uses: withastro/action@v2
with:
# path: . # The root location of your Astro project inside the repository. (optional)
# node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional)
package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
31 changes: 17 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
# build output
dist/
# generated types
.astro/

# Dependencies
# dependencies
node_modules/
# package-lock.json

# Eleventy
_site/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*

# Misc
.DS_Store

# environment variables
.env
.env.production

# Local Netlify folder
.netlify
# macOS-specific files
.DS_Store

gh-pages
gh-pages.pub
# jetbrains setting folder
.idea/
4 changes: 4 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode", "unifiedjs.vscode-mdx"],
"unwantedRecommendations": []
}
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}
9 changes: 6 additions & 3 deletions .eleventy.js → 11ty/.eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const EleventyPluginNavigation = require('@11ty/eleventy-navigation')
const EleventyPluginRss = require('@11ty/eleventy-plugin-rss')
const EleventyPluginSyntaxhighlight = require('@11ty/eleventy-plugin-syntaxhighlight')
const EleventyVitePlugin = require('@11ty/eleventy-plugin-vite')
const { EleventyHtmlBasePlugin } = require('@11ty/eleventy')

const rollupPluginCritical = require('rollup-plugin-critical').default

Expand All @@ -25,7 +26,7 @@ module.exports = function (eleventyConfig) {
alwaysWrapLineHighlights: false,
trim: true
})

eleventyConfig.addPlugin(EleventyHtmlBasePlugin)
eleventyConfig.addPlugin(EleventyVitePlugin, {
tempFolderName: '.11ty-vite', // Default name of the temp folder

Expand All @@ -35,7 +36,8 @@ module.exports = function (eleventyConfig) {
clearScreen: false,
server: {
mode: 'development',
middlewareMode: true
middlewareMode: true,
base: '/wdd231-course/'
},
appType: 'custom',
assetsInclude: ['**/*.xml', '**/*.txt'],
Expand Down Expand Up @@ -139,6 +141,7 @@ module.exports = function (eleventyConfig) {
includes: '_includes',
layouts: 'layouts',
data: '_data'
}
},
pathPrefix: '/wdd231-course/'
}
}
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions 11ty/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Logs
logs
*.log
npm-debug.log*

# Dependencies
node_modules/
# package-lock.json

# Eleventy
_site/

# Misc
.DS_Store
.env

# Local Netlify folder
.netlify

gh-pages
gh-pages.pub
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions 11ty/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Course materials for WDD 231
File renamed without changes.
File renamed without changes.
File renamed without changes.
57 changes: 57 additions & 0 deletions 11ty/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "eleventy-plus-vite",
"version": "0.2.2",
"description": "A clean and simple Eleventy 2 Starter Kit with Vite",
"browserslist": [
"> 0.5%",
"not IE 11"
],
"scripts": {
"start": "npx @11ty/eleventy --serve",
"watch": "npx @11ty/eleventy --watch",
"serve": "npx @11ty/eleventy --serve",
"bench": "DEBUG=Eleventy:Benchmark* npx @11ty/eleventy",
"build": "npx @11ty/eleventy",
"build:sass:prod": "sass src/static/scss:public/static/css --style compressed",
"build:eleventy:prod": "ELEVENTY_ENV=production eleventy",
"build:prod": "npm run build:eleventy:prod & npm run build:sass:prod",
"clean": "del-cli _site",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://matthiasott@github.com/matthiasott/11ty22.git"
},
"author": "Matthias Ott",
"license": "MIT",
"bugs": {
"url": "https://github.com/matthiasott/11ty22/issues"
},
"homepage": "https://github.com/matthiasott/11ty22#readme",
"devDependencies": {
"@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-img": "^3.1.0",
"@11ty/eleventy-navigation": "^0.3.5",
"@11ty/eleventy-plugin-rss": "^1.2.0",
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.0",
"@11ty/eleventy-plugin-vite": "^4.0.0",
"autoprefixer": "^10.4.7",
"cssnano": "^6.0.1",
"cssremedy": "^0.1.0-beta.2",
"del-cli": "^5.1.0",
"eslint": "^8.18.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.2.3",
"eslint-plugin-promise": "^6.0.0",
"focus-visible": "^5.2.0",
"luxon": "^3.4.3",
"markdown-it": "^13.0.1",
"markdown-it-anchor": "^8.6.7",
"npm-run-all": "^4.1.5",
"postcss-nesting": "^12.0.1",
"rollup-plugin-critical": "^1.0.12",
"sass": "^1.67.0",
"vite": "^4.4.9"
}
}
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/_includes/meta.njk → 11ty/src/_includes/meta.njk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{%- set absolutePageUrl -%}{{ page.url | url | absoluteUrl(meta.url) }}{%- endset -%}
{%- set absolutePageUrl -%}{{ page.url | absoluteUrl(meta.url) }}{%- endset -%}
{# General #}
<meta name="description" content="{{ description or meta.description }}">
<link rel="canonical" href="{{ absolutePageUrl }}">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<nav class="nav nav--primary" role="navigation" tabindex="-1">
<nav
class="nav nav--primary" role="navigation" tabindex="-1">
{# Nav Links #}
<ul class="nav__menu">
{%- for item in collections.all | eleventyNavigation -%}
{%- if item.url -%}
{%- set isCurrent = (item.url == page.url) -%}
{%- set isParent = item.url != '/' and item.url in page.url -%}
<li class="nav__item{% if isCurrent or isParent %} nav__item--active{% endif %}">
<a class="nav__link" href="{% if isCurrent %}#main{% else %}{{ item.url | url }}{% endif %}" {% if isCurrent %} aria-current="page" {% endif %}>
<a class="nav__link" href="{% if isCurrent %}#main{% else %}{{ item.url }}{% endif %}" {% if isCurrent %} aria-current="page" {% endif %}>
{{ item.title }}
</a>
</li>
{%- endif -%}
{%- endfor -%}
</ul>
</nav>
</nav>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ol reversed class="postlist">
{% for post in postslist %}
<li class="postlist-item{% if post.url == url %} postlist-item-active{% endif %}">
<a href="{{ post.url | url }}" class="postlist-link">
<a href="{{ post.url }}" class="postlist-link">
<h2>
{% if post.data.title %}
{{ post.data.title }}
Expand All @@ -13,7 +13,7 @@
<time class="postlist-date" datetime="{{ post.date | dateToFormat('yyyy-MM-dd') }}">{{ post.date | dateToFormat('dd LLL yyyy') }}</time>
{% for tag in post.data.tags | filterTagList %}
{% set tagUrl %}/tags/{{ tag | slug }}/{% endset %}
<a href="{{ tagUrl | url }}" class="post-tag">{{ tag }}</a>
<a href="{{ tagurl }}" class="post-tag">{{ tag }}</a>
{% endfor %}
</li>
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ol class="postlist">
{% for post in postslist %}
<li class="postlist-item{% if post.url == url %} postlist-item-active{% endif %}">
<a href="{{ post.url | url }}" class="postlist-link">
<a href="{{ post.url }}" class="postlist-link">
<h2>
{% if post.data.title %}
{{ post.data.title }}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions 11ty/src/feed.xml.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
permalink: /public/feed.xml
eleventyExcludeFromCollections: true
---

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>{{ meta.title }}</title>
<subtitle>{{ meta.description }}</subtitle>
<link href="{{ meta.url }}/feed.xml" rel="self" type="application/atom+xml"/>
<link href="{{ meta.url }}" rel="alternate" type="text/html"/>
<author>
<name>{{ meta.title }}</name>
</author>
{% if collections.posts %}
<updated>{{ collections.posts | rssLastUpdatedDate }}</updated>
{% endif %}
<id>{{ meta.url }}/</id>
{%- for post in collections.posts | reverse -%}
{% set absolutePostUrl %}{{ post.url | absoluteUrl(meta.url) }}{% endset %}
<entry>
<title>{{ post.data.title }}</title>
<link href="{{ absolutePostUrl }}"/>
<updated>{{ post.date | rssDate }}</updated>
<id>{{ absolutePostUrl }}</id>
<content type="html">
<![CDATA[
{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) | safe }}
]]>
</content>
</entry>
{%- endfor -%}
</feed>
File renamed without changes.
17 changes: 6 additions & 11 deletions src/layouts/base.njk → 11ty/src/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,11 @@
https://www.zachleat.com/web/comprehensive-webfonts/#critical-foft-with-preload */
/* (function () { if ("fonts" in document) { // Optimization for Repeat Views if
(sessionStorage.fontsLoadedCriticalFoftPreload) { document.documentElement.className += " fonts-loaded-2"; return; }
document .fonts .load("1em 'DM Sans Subset'") .then(function () {
document.documentElement.className += " fonts-loaded-1";
Promise.all(
[document.fonts.load("400 1em 'DM Sans'"), document.fonts.load("700 1em 'DM Sans'"), document.fonts.load("italic 1em 'DM Sans'"), document.fonts.load("italic 700 1em 'DM Sans'")]
).then(function () {
document.documentElement.className += " fonts-loaded-2";
// Optimization for Repeat Views
sessionStorage.fontsLoadedCriticalFoftPreload = true;
});
}); } })(); */
document .fonts .load("1em 'DM Sans Subset'") .then(function () { document.documentElement.className += "
fonts-loaded-1"; Promise.all( [document.fonts.load("400 1em 'DM Sans'"), document.fonts.load("700 1em 'DM Sans'"),
document.fonts.load("italic 1em 'DM Sans'"), document.fonts.load("italic 700 1em 'DM Sans'")] ).then(function () {
document.documentElement.className += " fonts-loaded-2"; // Optimization for Repeat Views
sessionStorage.fontsLoadedCriticalFoftPreload = true; }); }); } })(); */
</script>
<link rel="stylesheet" href="/assets/css/main.scss">
</head>
Expand All @@ -32,5 +27,5 @@
</main>
{% include "footer.njk" %}
</div>
<script type="module" src="{{ '/assets/js/main.js' | url }}"></script>
<script type="module" src="{{ 'assets/js/main.js' }}"></script>
</body></html>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 7 additions & 6 deletions src/sitemap.xml.njk → 11ty/src/sitemap.xml.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
permalink: /public/sitemap.xml
eleventyExcludeFromCollections: true
---

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{%- for item in collections.all -%}
{%- for item in collections.all -%}
{%- if not item.data.excludeFromSitemap and item.url -%}
<url>
<loc>{{ item.url | url | absoluteUrl(meta.url) }}</loc>
<url>
<loc>{{ item.url | absoluteUrl(meta.url) }}</loc>
<lastmod>{{ item.date | dateToFormat('yyyy-MM-dd') }}</lastmod>
</url>
</url>
{%- endif -%}
{%- endfor -%}
</urlset>
{%- endfor -%}
</urlset>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# Course materials for WDD 231
# Course Content for BYUI WDD 231 Frontend Development I

## Credit

This theme is based off of the lovely [Bear Blog](https://github.com/HermanMartinus/bearblog/).
11 changes: 11 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig } from "astro/config";
import mdx from "@astrojs/mdx";

import sitemap from "@astrojs/sitemap";

// https://astro.build/config
export default defineConfig({
site: "https://byui-cse.github.io",
base: "/wdd231-course",
integrations: [mdx(), sitemap()]
});
Loading

0 comments on commit 8901d4c

Please sign in to comment.