Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Vueで静的ブログを作りたい!

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.
Avatar for Naruto Naruto
January 21, 2020

 Vueで静的ブログを作りたい!

Avatar for Naruto

Naruto

January 21, 2020
Tweet

Other Decks in Programming

Transcript

  1. PLAN B PLAN B Nuxt.js設定ファイル (nuxt.config.js) 記事 コンテンツサーバー ページコンポーネント 記事一覧

    記事本文 日付...etc ルート生成 nuxt generate (静的サイト生成) nuxt (開発時) HTML
  2. Vue Server Renderer Vue.jsでのサーバーサイドレンダリングを提供 import Vue from 'vue' import {

    readFileSync } from 'fs' import { createRenderer } from 'vue-server-renderer' const renderer = createRenderer({ template: readFileSync('/path/to/template').toString() }) const vm = new Vue({ render: h => h('div', 'hello') }) renderer.renderToString(vm, {}).then(html => { console.log(html) // => hello }) https://ssr.vuejs.org/
  3. Webpackプラグイン import { Compiler } from 'webpack' export default class

    { apply(compiler: Compiler) { compiler.hooks.run.tap('MyPlugin', compilation => { console.log('Build process is starting!!!'); }); } } https://webpack.js.org/concepts/plugins/