-
Hey, I'm wondering what currently is the best way to install additional npm packages. There seems to have been somewhat of a shift in how doks is structured in the last years making some of the old posts irrelevant. Basically I'm trying to install a Lightbox so that users can zoom in on images. https://dimboxjs.com Installing this the old way by just adding an inline javascript to my header works, but I want to make use the npm setup from Doks. So I ran "npm install dim box" and tried to follow the guide from docsearch (https://getdoks.org/docs/add-ons/docsearch/) to get everything installed since this is basically trying to do the same thing. meaning:
While the css imports fine, the website on the other hand does not want to run the dimbox script using this method. I'm having trouble debugging this, so I'm wondering what the correct approach is for such a npm package. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The documentation will be updated — soonish 😄 Since the DimBox script is relatively small, you could/should go this route (minimizing the number of requests): https://github.com/orgs/gethyas/discussions/442#discussioncomment-7828474 For larger scripts (like e.g. DocSearch or Bootstrap) the route you followed above is recommended.
|
Beta Was this translation helpful? Give feedback.
The documentation will be updated — soonish 😄
Since the DimBox script is relatively small, you could/should go this route (minimizing the number of requests): https://github.com/orgs/gethyas/discussions/442#discussioncomment-7828474
For larger scripts (like e.g. DocSearch or Bootstrap) the route you followed above is recommended.
I think the script is loaded faster than the page is ready. So, make it
defer
:I would also load the SCSS (in stead of the CSS) — in
assets/scss/common/_custom.scss
(providing you more flexibility):