Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Sutto/barista
Browse files Browse the repository at this point in the history
  • Loading branch information
Sutto committed Nov 12, 2010
2 parents 27a9e2a + 2a7bc14 commit 90c2e9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/barista.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ def add_filter?
Rails.env.test? || Rails.env.development?
end

def add_preamble?
Rails.env.test? || Rails.env.development?
end

def no_wrap?
defined?(@no_wrap) && @no_wrap
end
Expand Down
5 changes: 5 additions & 0 deletions lib/barista/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def initialize(path, options = {})
def compile!
# Compiler code thanks to bistro_car.
@compiled_content = invoke_coffee(@path)
@compiled_content = preamble + @compiled_content if Barista.add_preamble?
@compiled = true
end

Expand All @@ -46,6 +47,10 @@ def self.dirty?(from, to)

protected

def preamble
"/* DO NOT MODIFY. This file was compiled from\n * #{@path}\n */\n\n"
end

def coffee_options
["-p"].tap do |options|
options << "--no-wrap" if Barista.no_wrap?
Expand Down

0 comments on commit 90c2e9c

Please sign in to comment.