brooksrelyt
brooksrelyt

Reputation: 4033

Jekyll node_modules not found while using load_paths

I am trying to configure jQuery in a Jekyll project. I am having issues referencing my script tags (if I include a cdn its fine).

I was reading up on some issues where github-pages may not process your node_modules. But, I am just working locally with no luck.

Would js files be loaded differently not under a sass: > load_paths:? Does it matter? (Sass files work fine but no js files are working)

_config.yml

sass:
  load_paths:
    - _sass
    - node_modules/

My footer:

<script src="{{'/node_modules/jquery/dist/jquery.min.js' | prepend: site.baseurl}}"></script>

Error:

[2019-03-27 12:44:36] ERROR `/node_modules/jquery/dist/jquery.min.js' not found.

Upvotes: 2

Views: 930

Answers (2)

Leon
Leon

Reputation: 346

Had the same issue. For me adding following to the _config.yml helped:

include             : [".htaccess", "node_modules"]
exclude             : ["Gemfile", "Gemfile.lock", "vendor/bundle/", "vendor/cache/", "vendor/gems/", "vendor/ruby/"]

It seems like just removing "node_modules" from exclude does not help, you have to explicitely add it to the includes.

Upvotes: 6

brooksrelyt
brooksrelyt

Reputation: 4033

Adding exclude: [] to my _config.yml file fixed this issue should this help anyone.

Upvotes: 2

Related Questions