Skip to content

Commit

Permalink
Build in Compass support.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdub committed Oct 31, 2012
1 parent 98d46b8 commit 82dd823
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ gem "haml"
gem "sass"
gem "RedCloth"
gem "rdiscount"
gem "compass"
38 changes: 38 additions & 0 deletions features/compass.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Feature: Compass integration

I want to integrate Compass
So that I can use it inside a layout

Background:

Given input file "_pith/config.rb" contains
"""
require 'pith/plugins/compass'
"""

Scenario: Sass template

Given input file "style.css.sass" contains
"""
@import "compass/typography/links/hover-link"
a.mylink
@include hover-link
"""

When I build the site
Then output file "style.css" should contain /a.mylink { text-decoration: none; }/

Scenario: Scss template

Given input file "style.css.scss" contains
"""
@import "compass/typography/links/hover-link";
a.mylink {
@include hover-link;
}
"""

When I build the site
Then output file "style.css" should contain /a.mylink { text-decoration: none; }/
28 changes: 28 additions & 0 deletions lib/pith/plugins/compass.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require "compass"
require "tilt/css"

module Pith
module Compass

module Initialize

def initialize(file=nil, line=1, options={}, &block)
options = options.merge(::Compass.sass_engine_options)
super(file, line, options, &block)
end

end

class SassTemplate < Tilt::SassTemplate
include Initialize
end

class ScssTemplate < Tilt::ScssTemplate
include Initialize
end

end
end

Tilt.register Pith::Compass::SassTemplate, 'sass'
Tilt.register Pith::Compass::ScssTemplate, 'scss'

1 comment on commit 82dd823

@travo
Copy link

@travo travo commented on 82dd823 Oct 31, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love all of this.

Please sign in to comment.