Search code examples
ruby-on-railsrubyjekylljekyll-extensions

How to disable hash in filename when using jekyll-assets


I'm new to Jekyll but so far it's really impressive. The whole asset's pipeline workflow is confusing to me though. In my config.yaml file I've got the following:

gems:
- jekyll-feed
- jekyll-assets
assets:
  autowrite: true
  prefix: "/assets"
  digest: true
  assets:
    - "*.png"
    - "*.jpg"
    - "*.svg"
  sources:
    - _assets/_img

All my images are in /_assets and so far running bundle exec jekyll serve copies all these files into _site/assets/ thus rendering them at http://127.0.0.1:4000/assets/.

The issue is that when it copies, for example, canlislogo.svg, it's new filename is canlislogo-ae5640da3ff77d178133e0ab015ef4aaa0accb025aa955c9c2aeca2ae32fbca9.svg, adding a long hash. Since I'm using Grunt for all my Stylus css creation, I don't need this hash. In fact, with it, I have no way of referencing these files.

How can I copy the assets automatically but drop the hash?

Please and thank you. :)


Solution

  • Replacing digest: true with digest: false should remove the hashes.

    That said, I'm surprised that asset-name wouldn't be automatically routed to asset-name-#{HASH} by Jekyll?