hassle icon indicating copy to clipboard operation
hassle copied to clipboard

Sass templates in app/stylesheets

Open molte opened this issue 15 years ago • 13 comments

This might not be an issue, but if you use Compass in a Rails application and store your Sass stylesheets in an app/stylesheets folder and compile them to public/stylesheets, how would you make this work with Hassle?

molte avatar Feb 22 '10 21:02 molte

+1 I'm trying to work this out now too.

alexslade avatar Mar 02 '10 17:03 alexslade

Put this in config.ru if you're using Rails 3, or environment.rb if you're using Rails 2:

Sass::Plugin.options[:template_location] = "./app/stylesheets"

jarinudom avatar Mar 08 '10 04:03 jarinudom

Ran into this issue as well. It fucks up royally when using hashes for the template_location, which pretty much means anyone using compass is screwed. Spent the entire day trying to debug this issue, as its really hard to iterate on heroku (checkin, deploy, wait, comb through logs).

merbjedi avatar Mar 10 '10 22:03 merbjedi

Oh actually I think the problem is that Hassle only goes 1 directory up from the template_location to decide where the tmp folder is, so it's trying to put the stylesheets at /app/tmp/whatever

jarinudom avatar Mar 10 '10 22:03 jarinudom

lol, I just found that out about 10 sec ago. Haha, what a pain in the ass this is!!! fix is close though

merbjedi avatar Mar 10 '10 22:03 merbjedi

I got my stylesheet to render at the root. /style.css Victory!

merbjedi avatar Mar 10 '10 22:03 merbjedi

narrowed the screwed up method to css_location:

def css_location(path)
  expanded = File.expand_path(path)
  public_dir = File.join(File.expand_path(Dir.pwd), "public")

  File.expand_path(compile_location(expanded.gsub(public_dir, ''), '..'))
end

merbjedi avatar Mar 10 '10 22:03 merbjedi

Maybe it would be worth walking the tree upward and testing for tmp directory.

jarinudom avatar Mar 10 '10 22:03 jarinudom

fixed! http://github.com/merbjedi/hassle/commit/e5374c3acd7ad6eb79b289954da058519b673690

merbjedi avatar Mar 10 '10 23:03 merbjedi

Perhaps it would be an advantage to look for the tmp directory in RACK_ROOT?

molte avatar Mar 11 '10 09:03 molte

yup, maybe. not sure though. where is RACK_ROOT set?

merbjedi avatar Mar 11 '10 09:03 merbjedi

Sorry, I think I might have confused it with RAILS_ROOT and RACK_ENV. I'm not sure it even exists...

molte avatar Mar 11 '10 13:03 molte