1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Add SCSS filter.

Add filter to generate CSS from Sass using SCSS syntax.

Addresses issue #474.

Signed-off-by: Norman Clarke <norman@njclarke.com>
This commit is contained in:
Matt Wildig 2012-01-23 03:26:49 +00:00 committed by Norman Clarke
parent 5afc955fdc
commit 9e3574bd9e
5 changed files with 41 additions and 1 deletions

View file

@ -13,8 +13,11 @@
* Generate object references based on `#to_key` if it exists in preference to `#id`.
* Add SCSS filter.
(thanks to [Matt Wildig](https://github.com/mattwildig))
* Helper `list_of` takes an extra argument that is rendered into list item attributes
(thanks [Iain Barnett](http://iainbarnett.me.uk/))
(thanks [Iain Barnett](http://iainbarnett.me.uk/))
* Fix parser to allow lines ending with `some_method?` to be a Ruby multinline
(thanks to [Brad Ediger](https://github.com/bradediger))

View file

@ -1259,6 +1259,11 @@ Embedded Ruby code is evaluated in the same context as the Haml template.
### `:sass`
Parses the filtered text with Sass to produce CSS output.
{#scss-filter}
### `:scss`
Parses the filtered text with Sass like the `:sass` filter, but uses the newer SCSS
syntax to produce CSS output.
{#textile-filter}
### `:textile`
Parses the filtered text with [Textile](http://www.textism.com/tools/textile).

View file

@ -313,6 +313,17 @@ END
end
end
# Parses the filtered text with {Sass} to produce CSS output using SCSS syntax.
module Scss
include Base
lazy_require 'sass/plugin'
# @see Base#render
def render(text)
::Sass::Engine.new(text, ::Sass::Plugin.engine_options.merge(:syntax => :scss)).render
end
end
# Parses the filtered text with ERB.
# Not available if the {file:HAML_REFERENCE.md#suppress_eval-option `:suppress_eval`} option is set to true.
# Embedded Ruby code is evaluated in the same context as the Haml template.

View file

@ -5,6 +5,13 @@
/* line 6 */
h1 { font-weight: normal; }
</style>
<style>
/* line 1 */
p { border-style: dotted; border-width: 22px; border-color: fuchsia; }
/* line 8 */
h1 { font-weight: normal; }
</style>
TESTING HAHAHAHA!
<p>
<script type='text/javascript'>

View file

@ -9,6 +9,20 @@
h1
:font-weight normal
%style
- width = 5 + 17
:scss
p {
border: {
style: dotted;
width: #{width}px;
color: #ff00ff
}
}
h1 {
font-weight: normal;
}
:test
This
Should