Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
フロントエンドカンファレンス北海道2024 『小規模サイトでも使えるVite 〜HTMLコーデ...
Search
h2ham
August 24, 2024
Programming
1
3.4k
フロントエンドカンファレンス北海道2024 『小規模サイトでも使えるVite 〜HTMLコーディングをよりスマートに〜』長谷川広武(ハム)
h2ham
August 24, 2024
Tweet
Share
More Decks by h2ham
See All by h2ham
WordCamp Kansai 2024 ハム『ブロックエディタでWebサイトの制作がどう変わったのか?実装事例から見る現在のWordPressの設計と構築』
h2ham
1
670
WordPress案件を請け負う制作会社からみる Shifter の魅力
h2ham
0
1.3k
WordCamp Osaka 2019 h2ham (´ ºムº `)
h2ham
7
4.8k
WordCamp Tokyo 2017 h2ham toro_unit
h2ham
1
7k
デザイナーが効率よくテーマ作成を進めるには? デザインから WordPress のテーマ作成のワークフローを見直す
h2ham
2
6.5k
Other Decks in Programming
See All in Programming
GoとPHPのインターフェイスの違い
shimabox
2
210
未経験でSRE、はじめました! 組織を支える役割と軌跡
curekoshimizu
1
170
たのしいSocketのしくみ / Socket Under a Microscope
coe401_
8
1.4k
The Clean ArchitectureがWebフロントエンドでしっくりこないのは何故か / Why The Clean Architecture does not fit with Web Frontend
twada
PRO
1
240
DRFを少しずつ オニオンアーキテクチャに寄せていく DjangoCongress JP 2025
nealle
2
280
5分で理解する SOLID 原則 #phpcon_nagoya
shogogg
1
390
『テスト書いた方が開発が早いじゃん』を解き明かす #phpcon_nagoya
o0h
PRO
9
2.5k
コミュニティ駆動 AWS CDK ライブラリ「Open Constructs Library」 / community-cdk-library
gotok365
2
250
もう僕は OpenAPI を書きたくない
sgash708
6
1.9k
はじめての Go * WASM *OCR
sgash708
1
110
Django NinjaによるAPI開発の効率化とリプレースの実践
kashewnuts
1
280
pylint custom ruleで始めるレビュー自動化
shogoujiie
0
160
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
75
9.2k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
A Philosophy of Restraint
colly
203
16k
Git: the NoSQL Database
bkeepers
PRO
428
65k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
13
1k
How to Ace a Technical Interview
jacobian
276
23k
Large-scale JavaScript Application Architecture
addyosmani
511
110k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.2k
How STYLIGHT went responsive
nonsquared
99
5.4k
Building Adaptive Systems
keathley
40
2.4k
Gamification - CAS2011
davidbonilla
80
5.2k
A Tale of Four Properties
chriscoyier
158
23k
Transcript
⼩規模サイトでも使えるVite 〜HTMLコーディングをよりスマートに〜 ⻑⾕川 広武 株式会社HAMWORKS
⾃⼰紹介
ハム ⻑⾕川 広武 は せ が わ ひろむ 株式会社HAMWORKS bit
part 合同会社 株式会社カワラバン SaCSS 主催
None
本題
https://ja.vitejs.dev/
https://ja.vitejs.dev/ ⾼速なビルドツール 軽量かつ直感的な開発環境 ⼩規模サイトでも導⼊が容易で、設定がシンプル Vite
None
None
None
src _layouts css js main.js assets index.html default.html header.html footer.html
style.css modules modules
dist css js main.js assets index.html style.css
src css js main.js assets index.html style.css 静的なページのビルド Static Site
Generation
src _layouts css js main.js assets index.html default.html header.html footer.html
style.css component modules
src _layouts css js main.js assets index.html default.html header.html footer.html
style.css component modules 納品後にCMSテンプレート化案件
余談
None
https://wordpress.org/news/2018/12/bebo/ 2018年12⽉6⽇
None
None
WordPress案件では 静的HTML制作は、もう⾏わない
src _layouts css js main.js assets index.html default.html header.html footer.html
style.css component modules WordPress 以外の 納品後にCMSテンプレート化案件
None
以前はローカルサーバー動かして PHPのインクルードで対応 なんて時代もあった
https://astro.build/
https://astro.build/ 最近では Astro の利⽤も
https://astro.build/
https://www.11ty.dev/
https://www.11ty.dev/ 11ty のほうが構成的にも HTML だけを⾒るならシンプルに
https://www.11ty.dev/
https://pugjs.org/api/getting-started.html
https://pugjs.org/api/getting-started.html
https://pugjs.org/api/getting-started.html
https://pugjs.org/api/getting-started.html CMSテンプレートにする場合 Pug は避けたい (そのまま使い難い)
https://ejs.co/
https://ejs.co/
https://ejs.co/ EJSもシンプルだが layout ベースでの構成だと ひと⼿間かかってしまう
https://mozilla.github.io/nunjucks/
https://mozilla.github.io/nunjucks/ 11ty で Nunjucks エンジン利⽤が 構成的にシンプル
https://docs.github.com/ja/pages
https://docs.github.com/ja/pages Nunjucks エンジンにしているのは GitHub Pages で使われていた jekyll がシンプルで好んでいる為
https://jekyllrb.com/
https://shopify.github.io/liquid/
https://jinja.palletsprojects.com/en/3.1.x/
None
None
None
None
シンプルな設定だけだと CSS・JSのビルド後のファイル名が ⾃動で変換かかってしまう
None
None
None
dist css js main.js assets index.html style.css
dist css js main.js assets index.html style.css ディレクトリ・ファイル名を 任意のものにするための コードを追加で、⾃由にできる
./src/assets/css/style.css
./src/assets/css/style.css Vite は、postcss-import を介した CSS @import のインライン化を デフォルトでサポート
まとめ
静的HTMLの案件でも Vite の利⽤が便利 CMS化案件時はシンプルに渡せるものを利⽤ Viteはデフォルトで CSS @import
の インライン化をサポート
以上!
ご清聴ありがとうございました