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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
現地で盛り上がった WWDC26 Keynote
zozotech
PRO
1
250
AIっぽい文章を採点して人間らしく直すアプリを作ってみた
yama3133
2
190
エラーバジェットのアラートのタイミングを考える.pdf
kairim0
0
150
人材育成分科会.pdf
_awache
4
250
いまさら聞けない「仕様駆動開発入門」 〜AI活用時代の開発プロセスを考える〜
findy_eventslides
1
100
Chainlitで作るお手軽チャットUI
ynt0485
0
250
AIネイティブな開発のサプライチェーンリスク対策 〜激動の開発現場でリスクに立ち向かう〜【ZennFes】
cscengineer
PRO
2
130
AIエージェントが名古屋の猛暑からあなたを守る
happysamurai294
0
120
作って終わりにしない タイミーのセマンティックレイヤー育成の現在地
chanyou0311
4
2.4k
Android の公式 Skill / Android skills
yanzm
0
150
2026TECHFRESH畢業分享會 - 葬送的通靈師:化系統與用戶雜訊成行動訊號
line_developers_tw
PRO
0
1k
気づかぬうちにセキュリティ負債を生むAPIキー運用
sgwrmctk
0
130
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
210
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
310
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
730
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
580
SEO for Brand Visibility & Recognition
aleyda
0
4.6k
Six Lessons from altMBA
skipperchong
29
4.3k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
300
How to Ace a Technical Interview
jacobian
281
24k
Being A Developer After 40
akosma
91
590k
Rails Girls Zürich Keynote
gr2m
96
14k
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