How to incorporate custom javascript #1457
-
Hello, Firstly, thank you to the community for everything that has been done on this project. I'm using this for several pieces of documentation! I'm currently running the docker implementation and wanted to incorporate extra javascript code. In the source folder I do see a javascripts folder but the all.js file appears to only have commented out lines ("//= require ./all_nosearch" and "//= require ./app/_search"). I'm a bit confused because I seem to be able to incorporate css into the stylesheets folder. Obviously I can include a <script> tag in the markdown file but would prefer to have things neat. Thanks again for the work and much appreciate the help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The Right now, your options to add your own JS would probably be:
|
Beta Was this translation helpful? Give feedback.
The
//= require
lines in the JS files are a custom pre-processor command that middleman-sprockets handles. Inall_nosearch.js
for example, for the//= require ./app/_copy
line is replaced by the contents of https://github.com/slatedocs/slate/blob/main/source/javascripts/app/_copy.js (./app/_copy.js
from the relative directory) in that preprocessing step.Right now, your options to add your own JS would probably be:
all_nosearch.js
(the require lines are relative to the location of that file).