This document explains how to build the minified distribution file from source.
Install the development dependencies:
npm install
Build the minified distribution file:
npm run build
This will:
src/ghost-toc.js using Terser<script> tagsdist/ghost-toc.min.jsRemove temporary build files:
npm run clean
The build process consists of two steps:
build:minify)Uses Terser to minify the source code:
-c)-m)/*!)dist/ghost-toc.temp.jsbuild:wrap)Runs scripts/wrap-script.js which:
package.json<script> tags for Ghost code injectiondist/ghost-toc.min.jsghost-toc/
├── src/
│ └── ghost-toc.js # Source code (edit this)
├── dist/
│ └── ghost-toc.min.js # Distribution file (auto-generated)
├── scripts/
│ └── wrap-script.js # Build wrapper script
└── package.json # Build configuration
src/ghost-toc.jsnpm run buildmaindist/ghost-toc.min.jssrc/ghost-toc.jsnpm run build to generate distribution fileexamples/Note: If you push to main branch, the Auto Build workflow will automatically rebuild the minified file if needed.
If you prefer not to use npm, you can manually minify:
<script> tags/* Ghost TOC v{version} | MIT License | github.com/vlavrynovych/ghost-toc */
Note: The automated build script reads the version from package.json, so you only need to update the version in one place.
Make sure you’ve run npm install to install development dependencies.
The clean script uses Unix commands. On Windows, either:
dist/ghost-toc.min.js) is committed to the repository for easy user access