Add a new compass-env() helper that returns the compass environment.
This commit is contained in:
parent
972c53ecb5
commit
d03d529909
@ -21,6 +21,7 @@ The Documentation for the [latest preview release](http://beta.compass-style.org
|
|||||||
* inline-font-files: actually works now
|
* inline-font-files: actually works now
|
||||||
* Upgrade CSS3 Pie to 1.0beta5
|
* Upgrade CSS3 Pie to 1.0beta5
|
||||||
* log sprite generation and removal to the console
|
* log sprite generation and removal to the console
|
||||||
|
* Added a new helper function `compass-env()` that returns the current compass environment (development, production)
|
||||||
|
|
||||||
|
|
||||||
0.12.alpha.0 (8/30/2011)
|
0.12.alpha.0 (8/30/2011)
|
||||||
|
@ -17,6 +17,7 @@ module Compass
|
|||||||
self.sass_options[:importer] = self.importer = Sass::Importers::Filesystem.new(from)
|
self.sass_options[:importer] = self.importer = Sass::Importers::Filesystem.new(from)
|
||||||
self.sass_options[:compass] ||= {}
|
self.sass_options[:compass] ||= {}
|
||||||
self.sass_options[:compass][:logger] = self.logger
|
self.sass_options[:compass][:logger] = self.logger
|
||||||
|
self.sass_options[:compass][:environment] = Compass.configuration.environment
|
||||||
self.staleness_checker = Sass::Plugin::StalenessChecker.new(sass_options)
|
self.staleness_checker = Sass::Plugin::StalenessChecker.new(sass_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2,9 +2,10 @@ module Compass::SassExtensions::Functions
|
|||||||
end
|
end
|
||||||
|
|
||||||
%w(
|
%w(
|
||||||
selectors enumerate urls display
|
selectors enumerate urls display
|
||||||
inline_image image_size constants gradient_support
|
inline_image image_size constants gradient_support
|
||||||
font_files lists colors trig sprites cross_browser_support
|
font_files lists colors trig
|
||||||
|
sprites env cross_browser_support
|
||||||
).each do |func|
|
).each do |func|
|
||||||
require "compass/sass_extensions/functions/#{func}"
|
require "compass/sass_extensions/functions/#{func}"
|
||||||
end
|
end
|
||||||
@ -24,6 +25,7 @@ module Sass::Script::Functions
|
|||||||
include Compass::SassExtensions::Functions::Trig
|
include Compass::SassExtensions::Functions::Trig
|
||||||
include Compass::SassExtensions::Functions::Sprites
|
include Compass::SassExtensions::Functions::Sprites
|
||||||
include Compass::SassExtensions::Functions::CrossBrowserSupport
|
include Compass::SassExtensions::Functions::CrossBrowserSupport
|
||||||
|
include Compass::SassExtensions::Functions::Env
|
||||||
end
|
end
|
||||||
|
|
||||||
# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
|
# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
|
||||||
|
5
lib/compass/sass_extensions/functions/env.rb
Normal file
5
lib/compass/sass_extensions/functions/env.rb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
module Compass::SassExtensions::Functions::Env
|
||||||
|
def compass_env
|
||||||
|
Sass::Script::String.new((options[:compass][:environment] || "development").to_s)
|
||||||
|
end
|
||||||
|
end
|
@ -73,6 +73,28 @@ class CompassTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_env_in_development
|
||||||
|
within_project('envtest', lambda {|c| c.environment = :development }) do |proj|
|
||||||
|
each_css_file(proj.css_path) do |css_file|
|
||||||
|
assert_no_errors css_file, 'envtest'
|
||||||
|
end
|
||||||
|
each_sass_file do |sass_file|
|
||||||
|
assert_renders_correctly sass_file, :ignore_charset => true, :environment => "development"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_env_in_production
|
||||||
|
within_project('envtest', lambda {|c| c.environment = :production }) do |proj|
|
||||||
|
each_css_file(proj.css_path) do |css_file|
|
||||||
|
assert_no_errors css_file, 'envtest'
|
||||||
|
end
|
||||||
|
each_sass_file do |sass_file|
|
||||||
|
assert_renders_correctly sass_file, :ignore_charset => true, :environment => "production"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_busted_image_urls
|
def test_busted_image_urls
|
||||||
within_project('busted_image_urls') do |proj|
|
within_project('busted_image_urls') do |proj|
|
||||||
each_css_file(proj.css_path) do |css_file|
|
each_css_file(proj.css_path) do |css_file|
|
||||||
@ -150,6 +172,7 @@ private
|
|||||||
|
|
||||||
if Compass.configuration.sass_path && File.exists?(Compass.configuration.sass_path)
|
if Compass.configuration.sass_path && File.exists?(Compass.configuration.sass_path)
|
||||||
compiler = Compass::Compiler.new *args
|
compiler = Compass::Compiler.new *args
|
||||||
|
compiler.clean!
|
||||||
compiler.run
|
compiler.run
|
||||||
end
|
end
|
||||||
yield Compass.configuration if block_given?
|
yield Compass.configuration if block_given?
|
||||||
|
Loading…
Reference in New Issue
Block a user