Skip to content

Commit

Permalink
chore: replace decap-cms with static-cms
Browse files Browse the repository at this point in the history
  • Loading branch information
HipsterBrown committed Mar 1, 2024
1 parent 64e089b commit 6ab77e5
Show file tree
Hide file tree
Showing 10 changed files with 12,412 additions and 7,183 deletions.
2 changes: 1 addition & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function getCategory(name) {
module.exports = (config) => {
config.on("eleventy.after", () => {
return esbuild.build({
entryPoints: ["js/app.ts"],
entryPoints: ["js/*.ts"],
bundle: true,
outdir: "_site/assets",
minify: process.env.ELEVENTY_ENV === "production",
Expand Down
2 changes: 1 addition & 1 deletion .envrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
use rtx
use mise
7 changes: 4 additions & 3 deletions admin/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ collections:
create: true
slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
sortable_fields:
- 'date'
- 'title'
- 'slug'
fields:
- 'date'
- 'title'
- 'slug'
editor:
preview: false
fields:
Expand Down
5 changes: 3 additions & 2 deletions admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="noindex" />
<title>Content Manager</title>
<link rel="stylesheet" href="/assets/admin.css" />
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
</head>

<body>
<decap-cms></decap-cms>
<script src="/assets/app.js"></script>
<static-cms></static-cms>
<script src="/assets/admin.js"></script>
</body>

</html>
13 changes: 0 additions & 13 deletions js/_elements/decap-cms-element.ts

This file was deleted.

15 changes: 15 additions & 0 deletions js/_elements/static-cms-element.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import CMS from '@staticcms/core';
import '@staticcms/core/dist/main.css';

class StaticCMSElement extends HTMLElement {
async connectedCallback() {
try {
CMS.init()
} catch (error) {
console.error('Unable to resolve @staticcms/core due to error: ', error)
return;
}
}
}

customElements.define('static-cms', StaticCMSElement);
1 change: 1 addition & 0 deletions js/admin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./_elements/static-cms-element";
1 change: 0 additions & 1 deletion js/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
import "./_elements/random-word-element";
import "./_elements/fit-text-element";
import "./_elements/scroll-nav-element";
import "./_elements/decap-cms-element";

0 comments on commit 6ab77e5

Please sign in to comment.