LoginSignup
11
5

More than 5 years have passed since last update.

Hugo のビルド時に HTML ファイルを圧縮(Minify)する

Last updated at Posted at 2018-11-05

hugo コマンドで静的サイトを生成する時にHTMLファイルを圧縮できます。

圧縮の方法

方法はとても簡単で、 hugo コマンドにオプションをつけるだけです。

hugo --minify

これを実行した後、 cat ./public/index.html とかで中身を見るとちゃんとHTMLが圧縮されていることが確認できます。

HTML内のCSSとJavaScriptも圧縮される

ちなみに <style> の中に書かれている CSS や <script> の中の JavaScript もちゃんと Minify されます。

参照

--minify minify any supported output format (HTML, XML etc.)

11
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
5