documentcloud / jammit

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

less/more support #32

Closed skippy closed 14 years ago

skippy commented 14 years ago

it seems that jammit and Less (using the More rails plugin) are not compatible. In dev mode, More redirects all /stylesheet requests to a controller, so the file doesn't exist on disk and jammit can't find it, combine, and compress it. That is not an issue for production (or if perform_cache) is enabled.

Their is definitely overlap, but their areas of focus are complimentary (css mixins, variables on one side and robust package management and compression on the other). I'm not sure if there is a 'right' way to get them to work together as one requires files on disk (jammit) and the other is all dynamic (more in development).

thoughts on if this is worth even trying to make work?

Ideally, I would like to be able to specify

jashkenas commented 14 years ago

Thanks for opening this ticket. We're not using Sass or Less at DocumentCloud, but Jammit should certainly be able to work with them.

If you add a before_filter that looks something like this:

before_filter :cache_stylesheets if Rails.env.development?

def cache_stylesheets
  Less::More.generate_all
end

Then it seems like you'd be able to use Jammit in the ordinary fashion, and still be able to rapidly develop your Less stylesheets without having to call a Rake task or restart the server. Does that work for you?

skippy commented 14 years ago

you know, this is really something that can/should be addressed in More, if at all. I'm chatting with them about that, but in the meanwhile something like:

before_filter { Less::More.parse } unless Less::More.page_cache?

(like your trick in the docs) works! Thanks

skippy commented 14 years ago

Thanks Jashkenas, I saw your note a bit late. you were too quick! ;)

jashkenas commented 14 years ago

Alright then ... closing the ticket. Feel free to reopen it if there's something about Jammit that needs changing to make it work.