LoginSignup
1
0

More than 3 years have passed since last update.

GitBookのHTMLをminifyするplugin

Last updated at Posted at 2017-06-14

GitBookのHTMLをminifyするプラグインを紹介します。

GitBook HTML minify Plugin

GitBook HTML minify Plugin

HTMLをminifyするGitBook Pluginです。

html-minifierをそのままGitbbok Plugin化しています。

インストールするだけでビルドされるHTMLがminifyされるようになります。

使い方

インストール

book.jsonhtml-minifierを追加して$ gitbook installを実行します。

{
  "plugins": ["html-minifier"]
}
$ gitbook install

設定

html-minifierで用意されている設定をそのまま使用できます。

Options Quick Referenceを参考にbook.jsonを調整すると思い通りのminifyが可能です。

{
  "plugins": ["html-minifier"],
  "pluginsConfig": {
    "html-minifier": {
      "caseSensitive": true,
      "collapseBooleanAttributes": true,
      "collapseInlineTagWhitespace": true,
      "collapseWhitespace": true,
      "conservativeCollapse": true,
      "customAttrAssign": [],
      "customAttrSurround": [],
      "decodeEntities": false,
      "html5": true,
      "includeAutoGeneratedTags": true,
      "keepClosingSlash": true,
      "minifyCSS": true,
      "minifyJS": true,
      "minifyURLs": false,
      "preserveLineBreaks": false,
      "preventAttributesEscaping": false,
      "processConditionalComments": false,
      "processScripts": [],
      "quoteCharacter": null,
      "removeAttributeQuotes": false,
      "removeComments": true,
      "removeEmptyAttributes": false,
      "removeEmptyElements": true,
      "removeOptionalTags": false,
      "removeRedundantAttributes": false,
      "removeScriptTypeAttributes": false,
      "removeStyleLinkTypeAttributes": false,
      "removeTagWhitespace": true,
      "sortAttributes": true,
      "sortClassName": true,
      "trimCustomFragments": false,
      "useShortDoctype": false,
    }
  }
}

License

MIT License

1
0
1

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
1
0