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
Angularの静的サイトジェネレーター「Scully」の最新情報
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
puku0x
October 17, 2020
Technology
380
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Angularの静的サイトジェネレーター「Scully」の最新情報
puku0x
October 17, 2020
More Decks by puku0x
See All by puku0x
新メンバーのために、シニアエンジニアが環境を作る時代
puku0x
0
1.5k
Agent Skills 入門
puku0x
0
1.9k
ファインディにおけるフロントエンド技術選定の歴史
puku0x
2
2.1k
生成AIではじめるテスト駆動開発
puku0x
0
1.4k
実践!カスタムインストラクション&スラッシュコマンド
puku0x
2
3.3k
Nx × AI によるモノレポ活用 〜コードジェネレーター編〜
puku0x
0
1.6k
ファインディにおけるフロントエンド技術選定の歴史
puku0x
2
300
ファインディでのGitHub Actions活用事例
puku0x
9
3.9k
Findyの開発生産性向上への取り組み ~Findyフロントエンドの場合~
puku0x
0
480
Other Decks in Technology
See All in Technology
やさしいA2A入門
minorun365
PRO
7
870
スキルと MCP ツール、責務をどう分けるか? AI が迷わないインターフェース設計の戦略
cdataj
0
480
実装は速くなった、レビューはどうする? ― 自身のレビューをAIで再現させるサーヴァントエンジニアリングのすゝめ / Implementation got faster. So what about reviews? — An invitation to Servant Engineering: Recreating your own code reviews with AI
nrslib
7
4.3k
Agentic ERPをどう設計するか ー 受発注エージェントを動かす、現場の知見と設計思想ー
recerqainc
1
2k
エンジニアリング戦略の作り方 / Crafting Engineering Strategy
iwashi86
15
4.8k
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
5
1.8k
React、まだ楽しくて草
uhyo
7
4.2k
Terraformモジュールは、なぜ「魔境」化するのか
hayama17
2
220
Claude Code の Sandbox 機能を Anthropic Sandbox Runtime(srt) で試そう!/lets-play-anthropic-sandbox-runtime
tomoki10
1
320
サプライチェーンセキュリティの空白地帯 - 信頼できる”依存性”の未来を考える
rung
PRO
2
800
Dario Amodi『Policy on the AI Exponential』を理解する
nagatsu
0
210
Reliability in the Age of AI: Engineering for AI Velocity
rrreeeyyy
0
110
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
463
34k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
230
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
エンジニアに許された特別な時間の終わり
watany
107
250k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
250
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
160
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
200
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Git: the NoSQL Database
bkeepers
PRO
432
67k
A designer walks into a library…
pauljervisheath
211
24k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Producing Creativity
orderedlist
PRO
348
40k
Transcript
Angularの静的サイトジェネレーター 「Scully」の最新情報 GDG DevFest 2020 @puku0x Noriyuki Shinpuku
Noriyuki Shinpuku ng-fukuoka organizer VEGA corporation Co., Ltd. @puku0x 2
@puku0x SSG流行ってる 3 Gridsome VuePress Nuxt.js Next.js Gatsby
@puku0x Angularは...? 4
@puku0x Scully • Angular用のSSG(静的サイトジェネレータ) 5 https://scully.io/ 9月にv1.0.0 リリース
@puku0x 仕組み • Angularアプリケーションを Puppeteer で実行 ◦ HttpClient等の通信完了を確認して出力 ◦ PLATFORM_IDが常にブラウザー
• 実行時はプリレンダされたHTML → 読み込み完了で Angularアプリケーションに置き換わる 6
$ ng new my-app --routing $ cd my-app $ ng
add @scullyio/init インストール 7
$ ng g @scullyio/init:blog $ ng g @scullyio/init:post --name="New Post"
ブログ作成 8
import { ScullyConfig } from '@scullyio/scully'; export const config: ScullyConfig
= { projectRoot: './src', projectName: my-app, outDir: './dist/static', routes: { … }, defaultPostRenderers: [], }; 設定ファイル 9
export const config: ScullyConfig = { routes: { '/users/:userId': {
type: 'json', userId: { url: 'https://jsonplaceholder.typicode.com/users', property: 'id', }, }, }, }; 動的コンテンツのプリレンダ 10
export const config: ScullyConfig = { routes: { '/blog/:slug': {
type: 'contentFolder', slug: { folder: './blog, }, }, }, }; ファイルからページ生成 11
constructor(private srs: ScullyRoutesService) {} post$ = this.srs.getCurrent().pipe( map((route: ScullyRoute) =>
({ title: route.title || route.route, description: route.description, slug: route.slug, })), shareReplay(1) ); ScullyRoutesService 12
$ ng build --prod $ npx scully --RSD --scan --prod
$ npm run scully:serve Angular distribution server started on “http://localhost:1864/” Scully static server started on “http://localhost:1668/” 実行 13
$ ng build --watch 開発 14 $ npx scully --watch
import { setPluginConfig } from '@scullyio/scully'; import { MarkedConfig }
from '@scullyio/scully/lib/fileHanderPlugins/markdown'; setPluginConfig<MarkedConfig>('md', { enableSyntaxHighlighting: true, }); シンタックスハイライト 15
import { ScullyConfig } from '@scullyio/scully'; export const config: ScullyConfig
= { … defaultPostRenderers: ['seoHrefOptimise'], }; リンクに末尾スラッシュ追加 16
$ npm i -D @scullyio/plugins-scully-plugin-remove-scripts $ ng build --prod <script>タグ削除
17 import { ScullyConfig, setPluginConfig } from '@scullyio/scully'; import { removeScripts, RemoveScriptsConfig } from '@scullyio/plugins-scully-plugin-remove-scripts'; setPluginConfig<RemoveScriptsConfig>(removeScripts, { keepTransferstate: false }); export const config: ScullyConfig = { defaultPostRenderers: [removeScripts], };
$ npm i -D @scullyio/scully-plugin-critical-css 不要なCSS削除 18 import { ScullyConfig
} from '@scullyio/scully'; import { criticalCSS } from '@scullyio/scully-plugin-critical-css'; export const config: ScullyConfig = { defaultPostRenderers: [criticalCSS], };
@puku0x PWA化 • @angular/service-workerとの組み合わせに課題 ◦ https://github.com/scullyio/scully/issues/529 ◦ https://github.com/angular/angular/issues/16051 • Workbox等の利用を推奨
19
import { registerPlugin } from '@scullyio/scully'; export const customPlugin =
'customPlugin'; const plugin = async (html: string): Promise<string> => { // レンダリングする文字列(HTML)を返す return html; }; registerPlugin('render', customPlugin, plugin); カスタムプラグイン 20
const plugin = async (html: string): Promise<string> => { const
workboxScript = ` <script defer scullyKeep> (function() { if ('serviceWorker' in navigator) { window.addEventListener('load', function() { navigator.serviceWorker.register(service-worker.js'); }); } })(); </script>`; return html.replace(/<\/head/i, `${workboxScript}</head`); }; registerPlugin('render', workboxPlugin, plugin); 21
@puku0x 22 https://github.com/puku0x/puku0x.net
@puku0x 23
@puku0x Scullyの今後 • ドキュメント拡充 • プラグイン追加 ◦ https://github.com/scullyio/scully/tree/main/libs/plugins • Angular以外も対応予定?
24
@puku0x まとめ • Scullyを使うと簡単にSSGを導入できる ◦ 既存の資産が活かせる ◦ エコシステム拡充中 ◦ https://scully.io/
25
@puku0x 26 https://www.vega-c.com/recruit/
Thank you! @puku0x Noriyuki Shinpuku