Extending
Adding Additional JS to the Configuration
You can enhance the functionality and styling of your site by adding custom JavaScript (JS) and Cascading Style Sheets (CSS) files. To do this, use the additional-js
and additional-css
fields in your book.toml
configuration file.
Steps to Include Additional JS
-
Locate the Configuration File:
Ensure you’re editing thebook.toml
file in your project’s root directory. -
Specify JS Files:
Under the[output.html]
section, add anadditional-js
field. List the paths to your JavaScript files relative to the source directory. For example:
1[output.html]
2additional-js = ["js/custom-script.js", "js/another-script.js"]
Adding Additional CSS to the Configuration
To include custom CSS files in your project, you can use the additional-css
field in the book.toml
configuration file. Follow these steps to add CSS files:
-
Locate the Configuration File:
Open thebook.toml
file in your project’s root directory. -
Specify CSS Files:
Under the[output.html]
section, add anadditional-css
field. List the paths to your CSS files relative to the source directory. For example:
1[output.html]
2additional-css = ["css/custom-style.css", "css/another-style.css"]