Skip to content

Commit

Permalink
Make & readme add
Browse files Browse the repository at this point in the history
  • Loading branch information
kajirikajiri committed Mar 28, 2024
1 parent aff09de commit 01b6291
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
all:
node scripts/make_post.js
8 changes: 8 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
makeで_postsに記事ができるので作成。
public/assets/blog/記事のtitle/*.(jpg|png|.*)に画像をおく。
scripts/build.jsでビルドしている。やや複雑。sh scripts/build.jsでdistにhtmlができるので確認する。
public/template.htmlは\<\!\-\-\-\-\>によって、分割して必要な属性を埋め込んでいる。
本番環境はcloudflareに上がっているが、こちらでもscripts/build.jsを使っている。
public/web_components.jsは先に読み込まれる必要があるので、data-cfasync="false"によって、cloudflareのjs遅延読み込みを無効化している
コンポーネントを使いたくなったらpublic/web_components.jsとweb_component_templates.htmlに追加

19 changes: 19 additions & 0 deletions scripts/make_post.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const fs = require('fs');
const path = require('path');

const content = `\
---
title: "title"
excerpt: "みなさんこんにちは、かじりです。概要"
created_at: "2024-03-28 21:07:53"
updated_at: "2024-03-28 21:07:53"
tags: [a, b]
---
みなさんこんにちは、かじりです。本文`;

fs.writeFile(path.join('_posts', '0.md'), content, (err) => {
if (err) throw err;
console.log('File created successfully.');
});

0 comments on commit 01b6291

Please sign in to comment.