jekyll-assets icon indicating copy to clipboard operation
jekyll-assets copied to clipboard

require_tree ../something works when compression: false even if path is not defined in assets:sources in _config.yml, but the same require_tree is silently ignored when compression: true

Open Nowaker opened this issue 4 years ago • 4 comments

Problem with require_tree

Use case:

  sources:
  - _assets/js
  - _assets/css
  - _assets/images
  - _assets/_sass/vendor/dreamhost-css/src/fonts
  # note: _assets/_sass/vendor/dreamhost-css/src/js is not listed here

main.js:

//=require_tree ../_sass/vendor/dreamhost-css/src/js

When compression: false is set, files inside the above directory will be included in the output of main.js.

However, when compression: true is set, this directory will NOT be included in the output of main.js. What's more, it will NOT raise any error during build.

require is not affected

  sources:
  - _assets/js
  - _assets/css
  - _assets/images
  - _assets/_sass/vendor/dreamhost-css/src/fonts
  # note: _assets/_sass/vendor/dreamhost-css/src/js is not listed here

main.js:

//=require ../_sass/vendor/dreamhost-css/src/js/scripts.js

require works as expected. That is, it raises an error.

Only after adding _assets/_sass/vendor/dreamhost-css/src/js to assets:sources makes it pass.

Request

Make require_tree always throw an error if the path where a JS is to be required from isn't listed in assets:sources, just like require.

  • [x] I tried updating to the latest version
  • [x] I Am on Linux
    • [x] All Linuxes affected
  • [x] I am on macOS 10.13
  • [x] I am on macOS 10.14

Nowaker avatar Oct 02 '19 20:10 Nowaker

I feel like this would be a Sprockets issue, all things considered we don't compress, or handle trees, we do indeed handle sources (we pass them into Sprockets) but other than that we don't typically deal with the compression, or the trees and finding assets.

envygeeks avatar Mar 06 '20 04:03 envygeeks

I don't know if it's Sprockets or Jekyll-assets, but compression is a documented Jekyll-assets option and it doesn't work properly and is silent about it.

Nowaker avatar Mar 07 '20 00:03 Nowaker

We can't be noisy about something we don't handle.

envygeeks avatar Mar 07 '20 00:03 envygeeks

Let me rephrase because I don't want you to think I don't care, I do care it's silent, I just don't know why and I feel like this might be a sprockets but, but I do plan on looking into it.

envygeeks avatar Mar 07 '20 00:03 envygeeks