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
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.7k
ファインディにおけるフロントエンド技術選定の歴史
puku0x
2
310
ファインディでのGitHub Actions活用事例
puku0x
9
3.9k
Findyの開発生産性向上への取り組み ~Findyフロントエンドの場合~
puku0x
0
490
Other Decks in Technology
See All in Technology
事業価値を⽣み出すSREへ SREが担うべき意思決定の5層
kenta_hi
0
130
初めてのDatabricks勉強会
taka_aki
2
230
フルAIで個人開発して学んだあれこれ / yuruai vol.1
isaoshimizu
0
170
記録をかんたんに、提案をパーソナルに ── AIであすけんが目指すもの
oprstchn
0
130
ゼロをイチにする仕事が終わったあと
smasato
0
270
飲食店もAIで。レジ締めやハンディシステムをつくってる話 / Using AI for restaurant management
vtryo
0
230
どうして今サーバーサイドKotlinを選択したのか
nealle
0
190
MySQL & MySQL HeatWave Report - June 2026
freshdaz
0
300
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
11k
“全部コピーしない”ファイルデータの活用 : — FSx for ONTAP × S3 Tables × Icebergで作るメタデータカタログ
yoshiki0705
0
350
なぜ私たちのSREプラクティスはなかなか機能しないのか 〜システムより先に組織を見る〜 / Why our SRE practices aren't really working
vtryo
0
160
HookでSAST、CIでSAST、SCAでどうにかしている話 / layered-security-for-ai-written-code-with-sast-and-sca
yamaguchitk333
0
100
Featured
See All Featured
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
270
Balancing Empowerment & Direction
lara
6
1.2k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
250
Bash Introduction
62gerente
615
220k
Into the Great Unknown - MozCon
thekraken
41
2.6k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
600
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
230
Color Theory Basics | Prateek | Gurzu
gurzu
0
380
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
150
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
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