You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got jQuery installed by npm in node_modules and I would like to pull that in using pelican-webassets. I imagine I'm not the first person to try this, but I can't suss out how from the documentation.
The text was updated successfully, but these errors were encountered:
I have no clue what I'm doing when it comes to anything with JavaScript (so someone please jump in if I'm wrong) but from what little I do understand, node_modules is essentially a cache directory for the npm package manager.
Assuming we're not using any type of JS compiler, we could add node_modules to the WEBASSETS_SOURCE_PATHS inside our pelican configuration
WEBASSETS_SOURCE_PATHS= ["node_modules"]
to get pelican-webassets to search for files inside the node_modules folder inside our THEME_STATIC_PATHS directory.
You should see a line like this near the beginning of the logs when building our website in DEBUG mode.
$ pelican -D | grep webassets
...
DEBUG: webassets: using assets in '/home/me/website/theme/node_modules'
...
Now that pelican-webassets is looking for files inside our node_modules folder, we can link to the jquery.js file inside our pelican templates.
I'm assuming the compiled jquery.js file will be inside node_modules/jquery/dist/. From what I can tell there are a few different version of jQuery. jquery.min.js, jquery.slim.js, jquery.slim.min.js. My system downloaded all of these inside the dist folder. YMMV
We can also define a bundle inside our pelican configuration file.
I've got jQuery installed by npm in
node_modules
and I would like to pull that in usingpelican-webassets
. I imagine I'm not the first person to try this, but I can't suss out how from the documentation.The text was updated successfully, but these errors were encountered: