Let me chat with Yehuda first to see if that's the way he recommends.

On Tue, Jul 27, 2010 at 12:31 PM, Jeroen van Dijk <
[email protected]> wrote:

> Sorry pressed the wrong button.. I got working what I wanted. Here is what
> I did:
>
> I added the following condition to the file /lib/sass/plugin/rails:
>
>     if Rails.env.development?
>       Rails.configuration.middleware.insert_before(ActionDispatch::Static,
> Sass::Plugin::Rack)
>     else
>       Rails.configuration.middleware.use(Sass::Plugin::Rack)
>     end
>
> Now Sass has precedence on ActionDispatch::Static which, I'm assuming given
> the name, serves otherwise the static files.
>
> So here is a list of my  middleware before the change
>
> >> Rails.application.middleware
>  => [ActionDispatch::Static, Rack::Lock,
> ActiveSupport::Cache::Strategy::LocalCache, Rack::Runtime,
> Rails::Rack::Logger, ActionDispatch::ShowExceptions,
> ActionDispatch::RemoteIp, Rack::Sendfile, ActionDispatch::Callbacks,
> ActionDispatch::Cookies, ActionDispatch::Session::CookieStore,
> ActionDispatch::Flash, ActionDispatch::ParamsParser, Rack::MethodOverride,
> ActionDispatch::Head, Warden::Manager, Sass::Plugin::Rack,
> HoptoadNotifier::Rack]
>
> and after
>
> => [Sass::Plugin::Rack, ActionDispatch::Static, Rack::Lock,
> ActiveSupport::Cache::Strategy::LocalCache, Rack::Runtime,
> Rails::Rack::Logger, ActionDispatch::ShowExceptions,
> ActionDispatch::RemoteIp, Rack::Sendfile, ActionDispatch::Callbacks,
> ActionDispatch::Cookies, ActionDispatch::Session::CookieStore,
> ActionDispatch::Flash, ActionDispatch::ParamsParser, Rack::MethodOverride,
> ActionDispatch::Head, Warden::Manager, HoptoadNotifier::Rack]
>
> Thanks for the help Nathan. Do you want to receive a pull request for the
> above?
>
> I'll now see if can do a decent monkey patch :)
>
> Cheers,
>
> Jeroen
>
>
> On Tue, Jul 27, 2010 at 9:23 PM, Jeroen van Dijk <
> [email protected]> wrote:
>
>> Just had a quick look and found a solution to my problem. I changed the
>> following line in lib/sass/plugin/rails.rb
>>
>>
>> On Tue, Jul 27, 2010 at 8:55 PM, Jeroen van Dijk <
>> [email protected]> wrote:
>>
>>> Thanks a lot. I'll check if I can get it working and probably report back
>>> somewhere tomorrow.
>>>
>>> Jeroen
>>>
>>>
>>> On Tue, Jul 27, 2010 at 8:47 PM, Nathan Weizenbaum <[email protected]>wrote:
>>>
>>>> It depends on how the Rails middleware stack is set up. Somewhere in
>>>> there is the Sass middleware, which will regenerate the CSS whenever it's
>>>> hit. However, if Rails puts the middleware for serving public/ higher in 
>>>> the
>>>> stack than the Sass middleware, you'll get the 404 before Sass ever has a
>>>> change to regenerate anything.
>>>>
>>>> I'll check it out when I have some time, but I'm not sure exactly when
>>>> that will be. You may be able to get a quick fix by manually using
>>>> Sass::Plugin::Rack in your config.ru, though.
>>>>
>>>> On Tue, Jul 27, 2010 at 11:30 AM, Jeroen van Dijk <
>>>> [email protected]> wrote:
>>>>
>>>>> Maybe we are talking about something different, because for me it
>>>>> really doesn't work.
>>>>>
>>>>> Just to be certain we are about the same things, this is what I do. I
>>>>> remove my screen.css and request my screen.css on the command line:
>>>>>
>>>>> curl localhost:3000/stylesheets/screen.css
>>>>>
>>>>> The first time I do this I get the 404 page, the second time curl shows
>>>>> me the stylesheet. So apparently a normal Rails request is needed to have
>>>>> the stylesheet be regenerated.
>>>>>
>>>>> Is this a bug then and should this work? Or did you mean something
>>>>> different?
>>>>>
>>>>> Either way, would love to have this working. Thanks for the suggestion
>>>>> of #update_stylesheets  will have a look at it.
>>>>>
>>>>> Cheers,
>>>>> Jeroen
>>>>>
>>>>> On Tue, Jul 27, 2010 at 7:44 PM, Nathan Weizenbaum 
>>>>> <[email protected]>wrote:
>>>>>
>>>>>> That should definitely be using the Rack middleware. It's possible
>>>>>> that Rails has some static-file middleware that takes precedence, though.
>>>>>>
>>>>>> In any case, calling Sass::Plugin.update_stylesheets will
>>>>>> intelligently update any stylesheets that need it.
>>>>>>
>>>>>> On Tue, Jul 27, 2010 at 1:00 AM, Jeroen van Dijk <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Thanks for your quick response. I'm using Rails indeed, running on
>>>>>>> edge. So you are saying that a bare stylesheet request should work?
>>>>>>>
>>>>>>> Here is some info from my Gemfile:
>>>>>>>
>>>>>>> gem "rails",    :git => "git://github.com/rails/rails.git", :ref =>
>>>>>>> "53b34e84762b7f2d6b64"
>>>>>>> haml (3.0.13)
>>>>>>> compass (0.10.2)
>>>>>>>
>>>>>>> Should I update one of the above?
>>>>>>>
>>>>>>> On Tue, Jul 27, 2010 at 9:54 AM, Nathan Weizenbaum <[email protected]
>>>>>>> > wrote:
>>>>>>>
>>>>>>>> I assume you're using Sass within Rails, or some other Ruby
>>>>>>>> framework? If you're using a recent version of Sass and Rails, Sass 
>>>>>>>> should
>>>>>>>> automatically hook itself in as Rack middleware, and will update the
>>>>>>>> stylesheets on each request. What versions are you using?
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tue, Jul 27, 2010 at 12:49 AM, Jeroen van Dijk <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> Hi all,
>>>>>>>>>
>>>>>>>>> I've been using Sass (and Haml) for a while now and I'm a very
>>>>>>>>> happy
>>>>>>>>> user. Thanks for all the work you guys have put in it.
>>>>>>>>>
>>>>>>>>> Recently I came across livereload (http://github.com/mockko/
>>>>>>>>> livereload). Really useful tool for any web developer. It actively
>>>>>>>>> monitors your files and reloads your page or assets without
>>>>>>>>> touching
>>>>>>>>> your browser manually. This works best for normal stylesheets and
>>>>>>>>> javascript files where it is just a reload of the specific asset
>>>>>>>>> file.
>>>>>>>>> For Sass this is different though. The whole page has to reload to
>>>>>>>>> update the stylesheets. I have been looking into this but I haven't
>>>>>>>>> seen a way around this. It seems that Sass needs a complete page
>>>>>>>>> request to generate the css files. For example, I removed the css
>>>>>>>>> files and did a curl request to just get the css page. This
>>>>>>>>> resulted
>>>>>>>>> in a 404.
>>>>>>>>>
>>>>>>>>> So my question is, is there a way to have Sass regenerate new css
>>>>>>>>> files solely based on a request of a css file? Say localhost:/3000/
>>>>>>>>> stylesheets/screen.css?new_time_stamp_here . If not, what would be
>>>>>>>>> the
>>>>>>>>> fastest way to regenerate the Sass file. Currently, using Compass,
>>>>>>>>> I
>>>>>>>>> just call a command line command : `compass compile` from within
>>>>>>>>> the
>>>>>>>>> Ruby process, but this can be done faster I hope/assume.
>>>>>>>>>
>>>>>>>>> Looking forward to any new insights.
>>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>>
>>>>>>>>> Jeroen
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> NB I'm using Sass with Compass, but I'm assuming the root cause/
>>>>>>>>> question lies with Sass.
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>>> Groups "Haml" group.
>>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>>> [email protected]<haml%[email protected]>
>>>>>>>>> .
>>>>>>>>> For more options, visit this group at
>>>>>>>>> http://groups.google.com/group/haml?hl=en.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>  --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "Haml" group.
>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>> [email protected]<haml%[email protected]>
>>>>>>>> .
>>>>>>>> For more options, visit this group at
>>>>>>>> http://groups.google.com/group/haml?hl=en.
>>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Haml" group.
>>>>>>> To post to this group, send email to [email protected].
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> [email protected]<haml%[email protected]>
>>>>>>> .
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/group/haml?hl=en.
>>>>>>>
>>>>>>
>>>>>>  --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Haml" group.
>>>>>> To post to this group, send email to [email protected].
>>>>>> To unsubscribe from this group, send email to
>>>>>> [email protected]<haml%[email protected]>
>>>>>> .
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/haml?hl=en.
>>>>>>
>>>>>
>>>>>  --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Haml" group.
>>>>> To post to this group, send email to [email protected].
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected]<haml%[email protected]>
>>>>> .
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/haml?hl=en.
>>>>>
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Haml" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected] <haml%[email protected]>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/haml?hl=en.
>>>>
>>>
>>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Haml" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected] <haml%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/haml?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to