Skip to content

Instantly share code, notes, and snippets.

@vangberg
Created January 30, 2009 01:28
Show Gist options
  • Save vangberg/54877 to your computer and use it in GitHub Desktop.
Save vangberg/54877 to your computer and use it in GitHub Desktop.
# We start with no Content-Type, and in Response#finish it is set to text/html
get "/one" do
erb :example
end
# Start with no Content-Type, sass() sets Content-Type to text/css, Response#finish doesn't touch it,
# because it already has been set, and thus what should have been text/html is now text/css
get "/two" do
erb :sass_example
end
# .. therefore, to have the pure-CSS work and sass() setting Content-Type = 'text/css' you would have
# to explicitly set the content type to text/html when using sass()-helper in view
get "/three" do
erb :sass_example
content_type 'text/html'
end
__END__
@@ example
<p>Some text</p>
@@ sass_example
<p>Here's some example CSS:</p>
<pre><code><%= sass(:foo) %></code></pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment