<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
  <channel>
    <title>Shotaro Nakamura - Leaves</title>
    <link>https://leaves.chiba.dev/users/16</link>
    <description>Shotaro Nakamura - Leaves</description>
    <image>
      <url>https://leaves.chiba.dev/favicon.ico</url>
    </image>
    
    <item>
      <title>Freshで、Tailwind v3を使う方法 | Shotaro Nakamura - Leaves</title>
      <link>https://leaves.chiba.dev/posts/137</link>
      <pubDate>Mon, 31 Jul 2023 07:40:58 GMT</pubDate>
      <guid>137</guid>
      <description>
## Freshで、Tailwind v3を使う方法
デフォルトだと、Freshは、Tailwind v2を使っている。これは、Twind v0を使っているからだ。

Twind v1にアップデートすることで、Tailwind v3を使うことができる。
## Steps
まず、`./main.ts`を以下のように書き換える。
```ts
import twindPlugin from &quot;$fresh/plugins/twind.ts&quot;; // Old
import twindPlugin from &quot;$fresh/plugins/twindv1.ts&quot;; // New
```
次に、`./twind.config.ts`を以下のように書き換える。
```ts
import { Options } from &quot;$fresh/plugins/twind.ts&quot;; // Old
import { Options } from &quot;$fresh/plugins/twindv1.ts&quot;; // New

import { defineConfig, Preset } from &quot;https://esm.sh/@twind/core@1.1.3&quot;; // New
import presetTailwind from &quot;https://esm.sh/@twind/preset-tailwind@1.1.4&quot;; // New, 現時点で1.1.4が最新

export default {
  ...defineConfig({
    presets: [presetTailwind() as Preset],
  }),
  selfURL: import.meta.url,
} as Options;
```
これでOK!
      </description>
    </item>
    
    <item>
      <title>開発中自作ゲームエンジン「KaguraJS」 | Shotaro Nakamura - Leaves</title>
      <link>https://leaves.chiba.dev/posts/136</link>
      <pubDate>Mon, 31 Jul 2023 07:26:34 GMT</pubDate>
      <guid>136</guid>
      <description>
## 開発中自作ゲームエンジン「KaguraJS」
小6から中1の初めのときくらいに作ってたやつをTypeScript/ESMで再実装中
https://nakasyou.github.io/KaguraJS/
```ts
import { Kagura, Sprite, Scene, Asset, type SceneConstructorOptions } from &quot;kagurajs&quot;

class MyScene extends Scene{
  gobo: Sprite
  speed?: number
  constructor (sceneConstructorOptions: SceneConstructorOptions) {
    super(sceneConstructorOptions)
    this.gobo = {} as Sprite
  }
  async init(){
    this.gobo = await new Sprite().init({
      asset: await new Asset().fromURL(&quot;./gobo.svg&quot;)
    })
    this.gobo.x = 100
    this.addChild(this.gobo)
  }
  async frame(){
    this.gobo.x ++
  }
}

const kagura = new Kagura({
  element: document.getElementById(&quot;game&quot;) as HTMLCanvasElement,
  startScene: MyScene,
})
await kagura.start()
```
      </description>
    </item>
    
    <item>
      <title>Hello | Shotaro Nakamura - Leaves</title>
      <link>https://leaves.chiba.dev/posts/135</link>
      <pubDate>Mon, 31 Jul 2023 05:57:34 GMT</pubDate>
      <guid>135</guid>
      <description>
# Hello
なんか面白そう
      </description>
    </item>
    
  </channel>
</rss>