documentcloud / jammit

Industrial Strength Asset Packaging for Rails
http://documentcloud.github.com/jammit/
MIT License
1.16k stars 197 forks source link

Request: Configurable whitelist for image embedding #93

Closed matellis closed 13 years ago

matellis commented 13 years ago

I'm using several toolkits that expect their images in a specific folder, i.e. I can't move their teensy little icons to a folder with 'embed' without forking the plugin.

Can we allow for a list of whitelisted image folders in the Assets.yml?

jashkenas commented 13 years ago

Yes... The reason why I decided to use an "embed" folder instead of whitelisting images in assets.yml was for simplicity -- instead of having another path to configure, just drop your images in embed, and you're done.

If we can figure out an objectively-nicer API for specifying embedded images, I'd be glad to change Jammit to use it.

matellis commented 13 years ago

Is there any reason we couldn't simply extend the assets.yml to look like:

embed_assets: on

javascripts:
  workspace:
    - public/javascripts/vendor/jquery.js
    - public/javascripts/lib/*.js
    - public/javascripts/views/**/*.js
    - app/views/workspace/*.jst

stylesheets:
  common:
    - public/stylesheets/reset.css
    - public/stylesheets/widgets/*.css
  workspace:
    - public/stylesheets/pages/workspace.css
  empty:
    - public/stylesheets/pages/empty.css

whitelist:
  - public/images/cupertino
  - public/images/ui.theme

etc.? I see you're currently using a regex of 'embed' in compression.rb We would have to build an array of these whitelisted folders and see if any of those matched too.

Or am I missing a bigger point? I'm new to jammit...

jashkenas commented 13 years ago

You could do it with an embeds array in assets.yml ... using directory globs like the others. It's not a particularly nice API though. Perhaps the best thing to do would be for you to try it out in your fork of Jammit, and see how it goes.

matellis commented 13 years ago

OK, I'll give it a go over the next few weeks. Thx.