Skip to content
Browse files

Configuration and refactoring, only add preamble in dev and test

  • Loading branch information...
1 parent f052ae3 commit 2a7bc147efc25b4e80589f9e2f7e3dcb820b59d4 @xaviershay xaviershay committed with Sutto Nov 9, 2010
Showing with 10 additions and 2 deletions.
  1. +4 −0 lib/barista.rb
  2. +6 −2 lib/barista/compiler.rb
View
4 lib/barista.rb
@@ -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
View
8 lib/barista/compiler.rb
@@ -31,8 +31,8 @@ def initialize(path, options = {})
def compile!
# Compiler code thanks to bistro_car.
- @compiled_content = "/* DO NOT MODIFY. This file was compiled from\n * #{@path}\n */\n\n" +
- invoke_coffee(@path)
+ @compiled_content = invoke_coffee(@path)
+ @compiled_content = preamble + @compiled_content if Barista.add_preamble?
@compiled = true
end
@@ -47,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?

0 comments on commit 2a7bc14

Please sign in to comment.
Something went wrong with that request. Please try again.