Integrating JS-File from Jekyll-Gem-Theme via Jekyll-Assets into Jekyll

Problem:
Jekyll-Assets can’t access or use Jekyll-GEM-Theme asset file (e.g. JS-File)

Scenario:

  1. Jekyll GEM Theme has a file: in path: assets/theme.js

  2. Jekyll repo has a file _assets/js/main.js
    Within this file is the line: //= require theme.js to import the file (Jekyll-Assets command).

  3. Jekyll config has enhanced the search path of Jekyll-Assets:
    assets:
    sources:
    - assets/js

Does anybody know or has a hint how to integrate Jekyll theme files by Jekyll-Assets?

Thank you very much.

1 Like

Hey there,

If you’re still looking for the solution, here is “jekyll-theme-assets” gem for that: https://rubygems.org/gems/jekyll-theme-assets.

The documentation is yet to be written, but here are a few quick visual hints how to use it with “jekyll-assets”.

Here is how to reference JS files:

… and here is how to reference images (lookup the highlighted blocks):

Hope that helps!

1 Like