Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 2327 Bytes
1 | require 'sass/plugin' |
2 | |
3 | module Sass |
4 | module Plugin |
5 | # Rack middleware for compiling Sass code. |
6 | # |
7 | # ## Activate |
8 | # |
9 | # require 'sass/plugin/rack' |
10 | # use Sass::Plugin::Rack |
11 | # |
12 | # ## Customize |
13 | # |
14 | # Sass::Plugin.options.merge( |
15 | # :cache_location => './tmp/sass-cache', |
16 | # :never_update => environment != :production, |
17 | # :full_exception => environment != :production) |
18 | # |
19 | # {file:SASS_REFERENCE.md#options See the Reference for more options}. |
20 | # |
21 | # ## Use |
22 | # |
23 | # Put your Sass files in `public/stylesheets/sass`. |
24 | # Your CSS will be generated in `public/stylesheets`, |
25 | # and regenerated every request if necessary. |
26 | # The locations and frequency {file:SASS_REFERENCE.md#options can be customized}. |
27 | # That's all there is to it! |
28 | class Rack |
29 | # Initialize the middleware. |
30 | # |
31 | # @param app [#call] The Rack application |
32 | def initialize(app) |
33 | @app = app |
34 | self.class.disable_native_plugin! |
35 | end |
36 | |
37 | # Process a request, checking the Sass stylesheets for changes |
38 | # and updating them if necessary. |
39 | # |
40 | # @param env The Rack request environment |
41 | # @return [(#to_i, {String => String}, Object)] The Rack response |
42 | def call(env) |
43 | Sass::Plugin.check_for_updates |
44 | @app.call(env) |
45 | end |
46 | |
47 | # Disable the native Rails or Merb plugins, if they're enabled. |
48 | # This is automatically done once the Rack plugin is activated. |
49 | # This is done so that the stylesheets aren't checked twice for each request. |
50 | def self.disable_native_plugin! |
51 | if defined?(Merb::Rack) && defined?(Merb::Rack::Application) && |
52 | Haml::Util.has?(:instance_method, Merb::Rack::Application, :call_without_sass) |
53 | Merb::Rack::Application.instance_eval {alias_method :call, :call_without_sass} |
54 | end |
55 | |
56 | if defined?(ActionDispatch::Callbacks) && defined?(ActionDispatch::Callbacks.to_prepare) |
57 | ActionDispatch::Callbacks.skip_callback(:prepare, :__sass_process) |
58 | elsif defined?(ActionController::Base) && |
59 | Haml::Util.has?(:instance_method, ActionController::Base, :sass_old_process) |
60 | ActionController::Base.instance_eval {alias_method :process, :sass_old_process} |
61 | end |
62 | end |
63 | end |
64 | end |
65 | end |