diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index 119d2d06..edb03654 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -1,6 +1,68 @@ COMPASS CHANGELOG ================= +0.10.0.pre9 (March 6, 2010) +--------------------------- + +* Fix a ruby 1.9 bug in the image_size helper functions for jpeg images. +* Silence a deprecation warning. + + +0.10.0.pre7 & 0.10.0.pre8 (February 23, 2010) +--------------------------------------------- + +* Rails 3 compatibility fixes +* Fix for rgba colors with the new gradient mixins +* A better error message if a color stop list is not passed in to the gradient mixins. + +0.10.0.pre6 (February 22, 2010) +------------------------------- + +**IMPORTANT:** + +* Rails users need to update their compass initializer. +* The CSS 3 Gradient mixins were re-written and their usage has changed. + +Read on for the details: + +### CLI +* Fixed some issues with colorized output. +* Don't force the user to specify the configuration path when calling compass config + +### Compass Core +* Fix to the bang_hack mixin (Credit: Mark Rajcok) +* Support :first-child and :last-child pseudo selectors for +horizontal-list. (Credit: Cody Robbins) +* Clear the sticky footer so that it works correctly with grid layouts. +* The css3 gradient module has been re-written and has a new, much simpler mixins. If you have been using the css3 gradient mixins, you'll need to update your sass stylesheets. The new mixins can be seen in action [here](http://compass-style.org/examples/css3/gradients.html). +* Added new helper functions: `image_width("path/to/image.png")` & `image_height("path/to/image.png")` that return the size in pixels. (Credit: Deepak Jois & Richard Aday) + +### Blueprint +* Take margins into account in liquid grid. (Credit: Christoffer Eliesen) + +### Rails +* Several Rails 3 bug fixes (Credit: Jacques Crocker) +* Don't set unset options on the Sass::Plugin +* Fixed a setup bug and handle compass configuration changes at rails boot. + +**IMPORTANT:** Existing rails projects _must_ change their compass initializer file to: + + require 'compass' + rails_root = (defined?(Rails) ? Rails.root : RAILS_ROOT).to_s + Compass.add_project_configuration(File.join(rails_root, "config", "compass.rb")) + Compass.configure_sass_plugin! + Compass.handle_configuration_change! + +### Internals +* New APIs for dealing with configuration changes and accessing a compiler instance. +* Provide a convenience function for discovering extensions: `Compass.discover_extensions!` that can be called during project configuration w/ other ruby frameworks. + +### Extensions + +* Don't force an extension to register itself just because it has ruby code. + This makes it easier for extensions to provide Sass functions from ruby. + +Special thanks to Daniel Hofstetter for fixing my typos. + 0.10.0.pre5 (January 18, 2010) ------------------------------ * Fixed a bug in the grid builder in ruby 1.8.6 (Credit: [Richard Wöber][der-rich]) diff --git a/REVISION b/REVISION index ce685447..31984d1e 100644 --- a/REVISION +++ b/REVISION @@ -1 +1 @@ -9503512782eba7e387ba0dec14e5cfe1f3c0f22b \ No newline at end of file +98908c49780d58a43681c484bb36c6ace0cc2d85 \ No newline at end of file diff --git a/Rakefile b/Rakefile index 3fc95592..1fe462cc 100644 --- a/Rakefile +++ b/Rakefile @@ -3,11 +3,13 @@ if ENV['RUN_CODE_RUN'] if File.directory?("haml") Dir.chdir("haml") do sh "git", "fetch" - sh "git", "reset", "--hard", "origin/stable" end else sh "git", "clone", "git://github.com/nex3/haml.git" end + Dir.chdir("haml") do + sh "git", "reset", "--hard", "origin/stable" + end $LOAD_PATH.unshift "haml/lib" end diff --git a/VERSION.yml b/VERSION.yml index d0ed1358..83aa52b7 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -2,4 +2,4 @@ :patch: 0 :major: 0 :minor: 10 -:build: pre5 +:build: rc1 diff --git a/compass.gemspec b/compass.gemspec index 9e6077a5..822bcd08 100644 --- a/compass.gemspec +++ b/compass.gemspec @@ -5,11 +5,11 @@ Gem::Specification.new do |s| s.name = %q{compass} - s.version = "0.10.0.pre5" + s.version = "0.10.0.rc1" s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["Chris Eppstein"] - s.date = %q{2010-01-19} + s.date = %q{2010-03-06} s.default_executable = %q{compass} s.description = %q{Compass is a Sass-based Stylesheet Framework that streamlines the creation and maintainance of CSS.} s.email = %q{chris@eppsteins.net} @@ -107,15 +107,37 @@ Gem::Specification.new do |s| "examples/compass/sticky_footer.html.haml", "examples/compass/utilities.html.haml", "examples/css3/config.rb", + "examples/css3/extensions/compass-colors/README.markdown", + "examples/css3/extensions/compass-colors/VERSION.yml", + "examples/css3/extensions/compass-colors/example/config.rb", + "examples/css3/extensions/compass-colors/example/src/_split_compliment_theme.sass", + "examples/css3/extensions/compass-colors/example/src/screen.sass", + "examples/css3/extensions/compass-colors/lib/compass-colors.rb", + "examples/css3/extensions/compass-colors/lib/compass-colors/compass_extension.rb", + "examples/css3/extensions/compass-colors/lib/compass-colors/hsl.rb", + "examples/css3/extensions/compass-colors/lib/compass-colors/sass_extensions.rb", + "examples/css3/extensions/compass-colors/spec/approximate_color_matching.rb", + "examples/css3/extensions/compass-colors/spec/sass_extensions_spec.rb", + "examples/css3/extensions/compass-colors/templates/analogous/_theme.sass", + "examples/css3/extensions/compass-colors/templates/analogous/manifest.rb", + "examples/css3/extensions/compass-colors/templates/basic/_theme.sass", + "examples/css3/extensions/compass-colors/templates/basic/manifest.rb", + "examples/css3/extensions/compass-colors/templates/complementary/_theme.sass", + "examples/css3/extensions/compass-colors/templates/complementary/manifest.rb", + "examples/css3/extensions/compass-colors/templates/split_complement/_theme.sass", + "examples/css3/extensions/compass-colors/templates/split_complement/manifest.rb", + "examples/css3/extensions/compass-colors/templates/triadic/_theme.sass", + "examples/css3/extensions/compass-colors/templates/triadic/manifest.rb", "examples/css3/extensions/fancy-fonts/templates/project/Vtks Revolt.ttf", "examples/css3/extensions/fancy-fonts/templates/project/angelina.ttf", "examples/css3/extensions/fancy-fonts/templates/project/fancy-fonts.sass", "examples/css3/extensions/fancy-fonts/templates/project/manifest.rb", + "examples/css3/gradients.html.haml", "examples/css3/images/fresh-peas.jpg", "examples/css3/index.html.haml", "examples/css3/src/_base.sass", "examples/css3/src/fancy-fonts.sass", - "examples/css3/src/gradient.sass", + "examples/css3/src/gradients.sass", "examples/css3/src/main.sass", "examples/css3/stylesheets/fonts/Vtks Revolt.ttf", "examples/css3/stylesheets/fonts/angelina.ttf", @@ -342,13 +364,13 @@ Gem::Specification.new do |s| "lib/compass/app_integration/merb.rb", "lib/compass/app_integration/merb/runtime.rb", "lib/compass/app_integration/rails.rb", - "lib/compass/app_integration/rails/action_controller.rb", + "lib/compass/app_integration/rails/actionpack2/action_controller.rb", + "lib/compass/app_integration/rails/actionpack2/sass_plugin.rb", + "lib/compass/app_integration/rails/actionpack2/urls.rb", "lib/compass/app_integration/rails/configuration_defaults.rb", "lib/compass/app_integration/rails/installer.rb", "lib/compass/app_integration/rails/runtime.rb", - "lib/compass/app_integration/rails/sass_plugin.rb", "lib/compass/app_integration/rails/templates/compass-install-rails.rb", - "lib/compass/app_integration/rails/urls.rb", "lib/compass/app_integration/stand_alone.rb", "lib/compass/app_integration/stand_alone/configuration_defaults.rb", "lib/compass/app_integration/stand_alone/installer.rb", @@ -400,10 +422,11 @@ Gem::Specification.new do |s| "lib/compass/logger.rb", "lib/compass/sass_extensions.rb", "lib/compass/sass_extensions/functions.rb", - "lib/compass/sass_extensions/functions/color_stop.rb", "lib/compass/sass_extensions/functions/display.rb", "lib/compass/sass_extensions/functions/enumerate.rb", "lib/compass/sass_extensions/functions/font_files.rb", + "lib/compass/sass_extensions/functions/gradient_support.rb", + "lib/compass/sass_extensions/functions/image_size.rb", "lib/compass/sass_extensions/functions/inline_image.rb", "lib/compass/sass_extensions/functions/selectors.rb", "lib/compass/sass_extensions/functions/urls.rb", @@ -438,11 +461,20 @@ Gem::Specification.new do |s| "test/fixtures/stylesheets/blueprint/sass/print.sass", "test/fixtures/stylesheets/blueprint/sass/screen.sass", "test/fixtures/stylesheets/blueprint/sass/typography.sass", + "test/fixtures/stylesheets/compass/100x150.jpg", "test/fixtures/stylesheets/compass/config.rb", + "test/fixtures/stylesheets/compass/css/gradients.css", + "test/fixtures/stylesheets/compass/css/image_size.css", "test/fixtures/stylesheets/compass/css/layout.css", "test/fixtures/stylesheets/compass/css/print.css", "test/fixtures/stylesheets/compass/css/reset.css", "test/fixtures/stylesheets/compass/css/utilities.css", + "test/fixtures/stylesheets/compass/images/100x150.gif", + "test/fixtures/stylesheets/compass/images/100x150.jpeg", + "test/fixtures/stylesheets/compass/images/100x150.jpg", + "test/fixtures/stylesheets/compass/images/100x150.png", + "test/fixtures/stylesheets/compass/sass/gradients.sass", + "test/fixtures/stylesheets/compass/sass/image_size.sass", "test/fixtures/stylesheets/compass/sass/layout.sass", "test/fixtures/stylesheets/compass/sass/print.sass", "test/fixtures/stylesheets/compass/sass/reset.sass", @@ -471,7 +503,7 @@ Gem::Specification.new do |s| s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] s.rubyforge_project = %q{compass} - s.rubygems_version = %q{1.3.5} + s.rubygems_version = %q{1.3.6} s.summary = %q{A Real Stylesheet Framework} s.test_files = [ "test/command_line_helper.rb", @@ -486,11 +518,20 @@ Gem::Specification.new do |s| "test/fixtures/stylesheets/blueprint/sass/print.sass", "test/fixtures/stylesheets/blueprint/sass/screen.sass", "test/fixtures/stylesheets/blueprint/sass/typography.sass", + "test/fixtures/stylesheets/compass/100x150.jpg", "test/fixtures/stylesheets/compass/config.rb", + "test/fixtures/stylesheets/compass/css/gradients.css", + "test/fixtures/stylesheets/compass/css/image_size.css", "test/fixtures/stylesheets/compass/css/layout.css", "test/fixtures/stylesheets/compass/css/print.css", "test/fixtures/stylesheets/compass/css/reset.css", "test/fixtures/stylesheets/compass/css/utilities.css", + "test/fixtures/stylesheets/compass/images/100x150.gif", + "test/fixtures/stylesheets/compass/images/100x150.jpeg", + "test/fixtures/stylesheets/compass/images/100x150.jpg", + "test/fixtures/stylesheets/compass/images/100x150.png", + "test/fixtures/stylesheets/compass/sass/gradients.sass", + "test/fixtures/stylesheets/compass/sass/image_size.sass", "test/fixtures/stylesheets/compass/sass/layout.sass", "test/fixtures/stylesheets/compass/sass/print.sass", "test/fixtures/stylesheets/compass/sass/reset.sass", diff --git a/examples/css3/gradients.html.haml b/examples/css3/gradients.html.haml new file mode 100644 index 00000000..a9a3ef3e --- /dev/null +++ b/examples/css3/gradients.html.haml @@ -0,0 +1,60 @@ +!!! +%html + %head + %link(href="stylesheets/gradients.css" rel="stylesheet" type="text/css") + %body + %table + %thead + %th   + %th.linear Linear + %th.radial Radial + %tbody + %tr.default + %th Default + %td.linear


+ %td.radial


+ %tr.default + %th + %td.linear-code + %td.radial-code + %tr.top-left + %th Top Left + %td.linear


+ %td.radial


+ %tr.top-left + %th + %td.linear-code + %td.radial-code + %tr.bottom-right + %th Bottom Right + %td.linear


+ %td.radial


+ %tr.bottom-right + %th + %td.linear-code + %td.radial-code + %tr.three-color + %th Three Evenly-spaced Colors + %td.linear


+ %td.radial


+ %tr.three-color + %th + %td.linear-code + %td.radial-code + %tr.four-color + %th Four Positioned Colors + %td.linear


+ %td.radial


+ %tr.four-color + %th + %td.linear-code + %td.radial-code + %tr.filled-in + %th Filled-in End-points + %td.linear


+ %td.radial


+ %tr.filled-in + %th + %td.linear-code + %td.radial-code + diff --git a/examples/css3/index.html.haml b/examples/css3/index.html.haml index 926429d9..abc30750 100644 --- a/examples/css3/index.html.haml +++ b/examples/css3/index.html.haml @@ -30,21 +30,23 @@ %h2 Gradients %pre.horizontal %code<> - +h-gradient(#d92626, #2626d9) + :preserve + +linear-gradient( + color_stops(#d92626, #2626d9), + "left") %pre.vertical %code<> - +v-gradient(#d92626, #2626d9) - %pre.diagonal - %code< - +linear-gradient("left top", - "right bottom", - \#d92626, #2626d9) + :preserve + +linear-gradient( + color_stops(#d92626, #2626d9)) %pre.radial %code<> - +radial-gradient(
"center center, 10, center center, 100",
#d92626, #2626d9) + +radial-gradient(
color_stops(#d92626, #2626d9)) + %a(href="gradients.html") More Gradients .examples #border-radius.example %h2 Border Radius + %p This box has rounded corners .gutter #box-shadow.example %h2 Box Shadow diff --git a/examples/css3/src/fancy-fonts.sass b/examples/css3/src/fancy-fonts.sass index f6fb1962..6648f776 100644 --- a/examples/css3/src/fancy-fonts.sass +++ b/examples/css3/src/fancy-fonts.sass @@ -1,6 +1,6 @@ @import compass/css3.sass -+font-face("Angelina", font-files("angelina.ttf", 'truetype')) ++font-face("Angelina", font_files("angelina.ttf", "truetype")) h1 font-family: "Angelina" font-size: 5em diff --git a/examples/css3/src/gradient.sass b/examples/css3/src/gradient.sass deleted file mode 100644 index bba90ecb..00000000 --- a/examples/css3/src/gradient.sass +++ /dev/null @@ -1,10 +0,0 @@ -@import compass/css3/gradient.sass - -#gradient - width: 200px - height: 100px - border: 1px solid #777 -.linear - +v-gradient(#fff, #aaa, color_stop(50%, #ccc, 50%, #bbb)) -.radial - +radial-gradient("45 45, 10, 52 50, 30", "Cyan", "DodgerBlue") diff --git a/examples/css3/src/gradients.sass b/examples/css3/src/gradients.sass new file mode 100644 index 00000000..53e5ca1f --- /dev/null +++ b/examples/css3/src/gradients.sass @@ -0,0 +1,69 @@ +@import compass/css3.sass + +#gradient + width: 200px + height: 100px + border: 1px solid #777 + +thead th + min-height: 50px + min-width: 100px + +text-shadow(#fff) +th.linear + +linear-gradient(color_stops(#fff, #f00 50%, #ff0 75%, #0f0)) +th.radial + +radial-gradient(color_stops(#fff, #f00 20px, #ff0 30px, #0f0 40px)) +tr.default + td.linear + +linear-gradient(color_stops(#c00, #00c)) + td.radial + +radial-gradient(color_stops(#c00, #00c)) + td.linear-code:before + content: "+linear-gradient(color_stops(#c00, #00c))" + td.radial-code:before + content: "+radial-gradient(color_stops(#c00, #00c))" +tr.top-left + td.linear + +linear-gradient(color_stops(#c00, #00c), "top left") + td.radial + +radial-gradient(color_stops(#c00, #00c), "top left") + td.linear-code:before + content: "+linear-gradient(color_stops(#c00, #00c), \"top left\")" + td.radial-code:before + content: "+radial-gradient(color_stops(#c00, #00c), \"top left\")" +tr.bottom-right + td.linear + +linear-gradient(color_stops(#c00, #00c), "bottom right") + td.radial + +radial-gradient(color_stops(#c00, #00c), "bottom right") + td.linear-code:before + content: "+linear-gradient(color_stops(#c00, #00c), \"bottom right\")" + td.radial-code:before + content: "+radial-gradient(color_stops(#c00, #00c), \"bottom right\")" +tr.three-color + td.linear + +linear-gradient(color_stops(#c00, #fff, #00c)) + td.radial + +radial-gradient(color_stops(#c00, #fff, #00c 50px)) + td.linear-code:before + content: "+linear-gradient(color_stops(#c00, #fff, #00c))" + td.radial-code:before + content: "+radial-gradient(color_stops(#c00, #fff, #00c 50px))" +tr.four-color + td.linear + +linear-gradient(color_stops(#c00, #0c0 25%, #0cc 75%, #00c)) + td.radial + +radial-gradient(color_stops(#c00, #0c0 25%, #0cc 75%, #00c 50px)) + td.linear-code:before + content: "+linear-gradient(color_stops(#c00, #0c0 25%, #0cc 75%, #00c))" + td.radial-code:before + content: "+radial-gradient(color_stops(#c00, #0c0 25%, #0cc 75%, #00c 50px))" +tr.filled-in + td.linear + +linear-gradient(color_stops(#c00 33%, #00c 66%)) + td.radial + +radial-gradient(color_stops(#c00 25px, #00c 75px)) + td.linear-code:before + content: "+linear-gradient(color_stops(#c00 33%, #00c 66%))" + td.radial-code:before + content: "+radial-gradient(color_stops(#c00 25px, #00c 75px))" diff --git a/examples/css3/src/main.sass b/examples/css3/src/main.sass index 25498754..5a6377e8 100644 --- a/examples/css3/src/main.sass +++ b/examples/css3/src/main.sass @@ -39,7 +39,7 @@ h1 content: " " .example - +v-gradient(#fff, #ccc) + +linear-gradient(color_stops(#fff, #ccc)) pre padding: 1em margin: 1em @@ -48,8 +48,8 @@ h1 font-weight: bold #background-clip pre - background: transparent #{image-url("fresh-peas.jpg")} no-repeat - border: 1em solid #{transparentize(red, .75)} + background: transparent #{image_url("fresh-peas.jpg")} no-repeat + border: 1em solid rgba(255,0,0,.25) .padding-box +background-clip("padding-box") +background-origin("padding-box") @@ -59,8 +59,9 @@ h1 #background-size pre - background: transparent #{image-url("fresh-peas.jpg")} no-repeat - border: 1em solid #{transparentize(red, .75)} + background: transparent #{image_url("fresh-peas.jpg")} no-repeat + border: 1em solid #{mix(red, white, .5)} + border: 1em solid rgba(255,0,0,.25) .top-left +background-size(50% 50%) .centered @@ -69,12 +70,39 @@ h1 #gradients .horizontal - +h-gradient(#d92626, #2626d9) + +linear-gradient(color_stops(#d92626, #2626d9), "left") .vertical - +v-gradient(#d92626, #2626d9) + +linear-gradient(color_stops(#d92626, #2626d9)) .diagonal - +linear-gradient("left top", "right bottom", #d92626, #2626d9) + +linear-gradient(color_stops(#d92626, #2626d9), "right top") .radial - +radial-gradient("center center, 10, center center, 100", #d92626, #2626d9) - background-color: #2626d9 + /* +radial-gradient(color_stops(#d92626 0, #2626d9 1)) + +radial-gradient(color_stops(#d92626 10px, #2626d9 150px)) + // +radial-gradient("center center, 10, center center, 100", #d92626, #2626d9) + // background-image: -moz-radial-gradient(20px center, circle, #d92626 10px, #2626d9 100px) + // background-color: #2626d9 + .radial-1 + // A default radial gradient: + /* +radial-gradient(color_stops(#ddd, #aaa)) + +radial-gradient(color_stops(#ddd, #aaa)) + .radial-2 + // A centered gradient + /* +radial-gradient(color_stops(#ddd, #aaa)) + +radial-gradient(color_stops(#ddd, #aaa)) + .radial-3 + // A centered radial gradient at the top + /* +radial-gradient(color_stops(#ddd, #aaa), "top center") + +radial-gradient(color_stops(#ddd, #aaa), "top center") + .radial-4 + // A centered radial gradient with fixed color stops + /* +radial-gradient(color_stops(#ddd 20px, #aaa 50px)) + +radial-gradient(color_stops(#ddd 20px, #aaa 50px)) + .radial-5 + // A centered gradient with several color stops + /* +radial-gradient(color_stops(#ddd 20%, #aaa 50%, #c00)) + +radial-gradient(color_stops(#ddd 20px, #aaa 50%, #c00 200px)) + .radial-6 + // A centered gradient with color stops + /* +radial-gradient(color_stops(#0c0, #ddd 20%, #aaa 50%, #00c)) + +radial-gradient(color_stops(#0c0 0px, #ddd 20px, #aaa 50px, #00c 100px)) diff --git a/frameworks/blueprint/stylesheets/blueprint/_liquid.sass b/frameworks/blueprint/stylesheets/blueprint/_liquid.sass index 0e41d32e..43bffeb1 100644 --- a/frameworks/blueprint/stylesheets/blueprint/_liquid.sass +++ b/frameworks/blueprint/stylesheets/blueprint/_liquid.sass @@ -36,13 +36,13 @@ // Main layout grid, override these constants to build your grid and container sizes. // The width shown gives the right floored percentage values. !blueprint_liquid_grid_columns ||= 24 -!blueprint_liquid_grid_width ||= 4.173% -!blueprint_liquid_grid_margin ||= 0.833em +!blueprint_liquid_grid_width ||= 3.167% +!blueprint_liquid_grid_margin ||= 1.042% // Do not edit below this line unless you really know what you're doing. !blueprint_liquid_container_width = 80% !blueprint_liquid_container_min_width = 950px -!blueprint_liquid_grid_push_pull = -(!blueprint_liquid_grid_margin * 4) +!blueprint_liquid_grid_push_pull = -(!blueprint_liquid_grid_margin + !blueprint_liquid_grid_width) =blueprint-liquid-grid // A container should group all your columns @@ -82,7 +82,7 @@ +clearfix =span(!n, !override = false) - !width = (!blueprint_liquid_grid_width * !n) - ((!blueprint_liquid_grid_width * !n) % 1) + !width = (!blueprint_liquid_grid_width * !n) + (!blueprint_liquid_grid_margin * (!n - 1)) @if !override width= !width !important @else @@ -101,10 +101,10 @@ margin-right= !blueprint_liquid_grid_margin =append(!n) - padding-right= (!blueprint_liquid_grid_width * !n) - ((!blueprint_liquid_grid_width * !n) % 1) + padding-right= (!blueprint_liquid_grid_width + !blueprint_liquid_grid_margin) * !n =prepend(!n) - padding-left= (!blueprint_liquid_grid_width * !n) - ((!blueprint_liquid_grid_width * !n) % 1) + padding-left= (!blueprint_liquid_grid_width + !blueprint_liquid_grid_margin) * !n =pull(!n, !last = false) margin-left= (!blueprint_liquid_grid_push_pull * !n) @@ -113,7 +113,7 @@ +float-right margin: top: 0 - left: 1.5em + left= !blueprint_liquid_grid_margin right= (!blueprint_liquid_grid_push_pull * !n) bottom: 0 @@ -121,8 +121,8 @@ border-right: 1px solid #eee =colborder - padding-right: 2% - margin-right: 2% + padding-right= !blueprint_liquid_grid_margin * 2 + margin-right= !blueprint_liquid_grid_margin * 2 +border =colruler @@ -131,7 +131,9 @@ clear: both width: 100% height: 0.083em - margin: 0 0 1.583em + margin: 0 + margin-left= !blueprint_liquid_grid_margin * 2 + margin-right= !blueprint_liquid_grid_margin * 2 border: none =colspacer diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass index 04cd2ea3..d46ec44a 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass @@ -1,2 +1,2 @@ -@debug "DEPRECATION WARINING: blueprint/modules/buttons.sass has moved to blueprint/buttons.sass" +@debug "DEPRECATION WARNING: blueprint/modules/buttons.sass has moved to blueprint/buttons.sass" @import blueprint/buttons.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass index 5dd98c92..45575213 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass @@ -1,2 +1,2 @@ -@debug "DEPRECATION WARINING: blueprint/modules/colors.sass has moved to blueprint/colors.sass" +@debug "DEPRECATION WARNING: blueprint/modules/colors.sass has moved to blueprint/colors.sass" @import blueprint/colors.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass index a78c6e98..b87bb954 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass @@ -1,2 +1,2 @@ -@debug "DEPRECATION WARINING: blueprint/modules/debug.sass has moved to blueprint/debug.sass" +@debug "DEPRECATION WARNING: blueprint/modules/debug.sass has moved to blueprint/debug.sass" @import blueprint/debug.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass index 5a43f5f9..6d378738 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass @@ -1,2 +1,2 @@ -@debug "DEPRECATION WARINING: blueprint/modules/fancy_type.sass has moved to blueprint/fancy_type.sass" +@debug "DEPRECATION WARNING: blueprint/modules/fancy_type.sass has moved to blueprint/fancy_type.sass" @import blueprint/fancy_type.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass index 7b455c81..b37d6776 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass @@ -1,2 +1,2 @@ -@debug "DEPRECATION WARINING: blueprint/modules/form.sass has moved to blueprint/form.sass" +@debug "DEPRECATION WARNING: blueprint/modules/form.sass has moved to blueprint/form.sass" @import blueprint/form.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass index fd72b845..66a1dd16 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass @@ -1,2 +1,2 @@ -@debug "DEPRECATION WARINING: blueprint/modules/grid.sass has moved to blueprint/grid.sass" +@debug "DEPRECATION WARNING: blueprint/modules/grid.sass has moved to blueprint/grid.sass" @import blueprint/grid.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass index 9b2ba76b..0af84e21 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass @@ -1,2 +1,2 @@ -@debug "DEPRECATION WARINING: blueprint/modules/interaction.sass has moved to blueprint/interaction.sass" +@debug "DEPRECATION WARNING: blueprint/modules/interaction.sass has moved to blueprint/interaction.sass" @import blueprint/interaction.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass index 7b38ceba..be69a37c 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass @@ -1,2 +1,2 @@ -@debug "DEPRECATION WARINING: blueprint/modules/link_icons.sass has moved to blueprint/link_icons.sass" +@debug "DEPRECATION WARNING: blueprint/modules/link_icons.sass has moved to blueprint/link_icons.sass" @import blueprint/link_icons.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass index eed1e601..fb2ebe8a 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass @@ -1,3 +1,3 @@ -@debug "DEPRECATION WARINING: blueprint/modules/liquid.sass has moved to blueprint/liquid.sass" +@debug "DEPRECATION WARNING: blueprint/modules/liquid.sass has moved to blueprint/liquid.sass" @import blueprint/liquid.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass index 297ea8b4..229d432b 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass @@ -1,2 +1,2 @@ -@debug "DEPRECATION WARINING: blueprint/modules/reset.sass has moved to blueprint/reset.sass" +@debug "DEPRECATION WARNING: blueprint/modules/reset.sass has moved to blueprint/reset.sass" @import blueprint/reset.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass index 8cd4d0d8..36a29470 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass @@ -1,2 +1,2 @@ -@debug "DEPRECATION WARINING: blueprint/modules/rtl.sass has moved to blueprint/rtl.sass" +@debug "DEPRECATION WARNING: blueprint/modules/rtl.sass has moved to blueprint/rtl.sass" @import blueprint/rtl.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass index a68b8886..9082f4cf 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass @@ -1,2 +1,2 @@ -@debug "DEPRECATION WARINING: blueprint/modules/scaffolding.sass has moved to blueprint/scaffolding.sass" +@debug "DEPRECATION WARNING: blueprint/modules/scaffolding.sass has moved to blueprint/scaffolding.sass" @import blueprint/scaffolding.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass index d2f1a943..155c30af 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass @@ -1,2 +1,2 @@ -@debug "DEPRECATION WARINING: blueprint/modules/typography.sass has moved to blueprint/typography.sass" +@debug "DEPRECATION WARNING: blueprint/modules/typography.sass has moved to blueprint/typography.sass" @import blueprint/typography.sass diff --git a/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass b/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass index 57994368..3695d191 100644 --- a/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass +++ b/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass @@ -1,2 +1,2 @@ -@debug "DEPRECATION WARINING: blueprint/modules/utilities.sass has moved to blueprint/utilities.sass" +@debug "DEPRECATION WARNING: blueprint/modules/utilities.sass has moved to blueprint/utilities.sass" @import blueprint/utilities.sass diff --git a/frameworks/compass/stylesheets/compass/css3/_gradient.sass b/frameworks/compass/stylesheets/compass/css3/_gradient.sass index a3432011..f4eafc92 100644 --- a/frameworks/compass/stylesheets/compass/css3/_gradient.sass +++ b/frameworks/compass/stylesheets/compass/css3/_gradient.sass @@ -1,46 +1,57 @@ +// This yields a linear gradient spanning from top to bottom // - Gradient mixin for all types of gradients. Use the other mixins for specific types of gradients. - - Arguments are type, coords, color_start, color_end and color_stop - -=gradient(!type, !coords, !color_start, !color_end, !color_stop = false) - !gradient= "#{!coords}, from(#{!color_start}), to(#{!color_end})" - @if !color_stop - !gradient= !gradient + ", " + !color_stop - background: -webkit-gradient(#{!type}, #{!gradient}) - background: -moz-#{!type}-gradient(#{!gradient}) - +// +linear-gradient(color_stops(white, black)) // - This will yield a radial gradient with an apparent specular highlight - +radial-gradient("45 45, 10, 52 50, 30", Cyan, DodgerBlue) - -=radial-gradient(!coords, !color1, !color2, !color_stop = false) - +gradient("radial", !coords, !color1, !color2, !color_stop) - +// This yields a linear gradient spanning from bottom to top // - This yields a linear gradient spanning from !start to !end coordinates - +linear-gradient("left top", "left bottom", #fff, #ddd) - -=linear-gradient(!start, !end, !color1, !color2, !color_stop = false) - !coords = !start + ", " + !end - +gradient("linear", !coords, !color1, !color2, !color_stop) - +// +linear-gradient(color_stops(white, black), "bottom") // - This yields a gradient starting at the top with #fff, ending in #aaa - +v-gradient(#fff, #aaa) - - Same as above but with a #ccc at the halfway point - +v-gradient(#fff, #aaa, color_stop(50%, #ccc)) - - Same as the first example but with #ccc at the 30% from the top, and #bbb at 70% from the top - +v-gradient(#fff, #aaa, color_stop(30%, #ccc, 70%, #bbb)) - -=v-gradient(!color1, !color2, !color_stop = false) - +linear-gradient("left top", "left bottom", !color1, !color2, !color_stop) - +// This yields a linear gradient spanning from left to right // - This yields a horizontal linear gradient spanning from left to right. It can be used just like v-gradient above - h-gradient(#fff, #ddd) +// +linear-gradient(color_stops(white, black), "left") +// +// This yields a linear gradient starting at white passing +// thru blue at 33% down and then to black +// +// +linear-gradient(color_stops(white, blue 33%, black)) +// +// This yields a linear gradient starting at white passing +// thru blue at 33% down and then to black at 67% until the end +// +// +linear-gradient(color_stops(white, blue 33%, black 67%)) +// +// Browsers Supported: +// +// - Chrome +// - Safari +// - Firefox 3.6 -=h-gradient(!color1, !color2, !color_stop = false) - +linear-gradient("left top", "right top", !color1, !color2, !color_stop) \ No newline at end of file +=linear-gradient(!color_stops, !start = "top") + // Firefox's gradient api is nice. + // Webkit's gradient api sucks -- hence these backflips: + !end = grad_opposite_position(!start) + background-image: -webkit-gradient(linear, #{grad_point(!start)}, #{grad_point(!end)}, #{grad_color_stops(!color_stops)}) + background-image: -moz-linear-gradient(#{!start}, #{!color_stops}) + +// Due to limitation's of webkit, the radial gradient mixin works best if you use +// pixel-based color stops. +// +// Examples: +// +// // Defaults to a centered, 100px radius gradient +// +radial-gradient(color_stops(#c00, #00c)) +// // 100px radius gradient in the top left corner +// +radial-gradient(color_stops(#c00, #00c), "top left") +// // Three colors, ending at 50px and passing thru #fff at 25px +// +radial-gradient(color_stops(#c00, #fff, #00c 50px)) +// +// Browsers Supported: +// +// - Chrome +// - Safari +// - Firefox 3.6 + +=radial-gradient(!color_stops, !center_position = "center center") + !end_pos = grad_end_position(!color_stops, true) + background-image: -webkit-gradient(radial, #{grad_point(!center_position)}, 0, #{grad_point(!center_position)}, #{!end_pos}, #{grad_color_stops(!color_stops)}) + background-image: -moz-radial-gradient(#{!center_position}, circle, #{!color_stops}) diff --git a/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass b/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass index 7ab874ca..f6dd573f 100644 --- a/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass +++ b/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass @@ -7,6 +7,7 @@ html, body height: 100% #{!root_selector} + clear: both min-height: 100% height: auto !important height: 100% diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_min.sass b/frameworks/compass/stylesheets/compass/utilities/general/_min.sass index 5f454547..c8e14eba 100644 --- a/frameworks/compass/stylesheets/compass/utilities/general/_min.sass +++ b/frameworks/compass/stylesheets/compass/utilities/general/_min.sass @@ -13,5 +13,5 @@ // @private This mixin is not meant to be used directly. =hacked-minimum(!property, !value) min-#{!property}= !value - +bang-hack(!property, !value, 'auto') + +bang-hack(!property, !value, "auto") diff --git a/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass b/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass index 8c601d6c..04205ef0 100644 --- a/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass +++ b/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass @@ -30,6 +30,10 @@ //** Can be mixed into any li selector that is meant to participate in a horizontal layout. Used to implement +horizontal-list. + + :last-child is not fully supported + see http://www.quirksmode.org/css/contents.html#t29 for the support matrix + =horizontal-list-item(!padding = 4px) +no-bullet white-space: nowrap @@ -37,9 +41,9 @@ padding: left= !padding right= !padding - &.first + &:first-child, &.first padding-left: 0px - &.last + &:last-child, &.last padding-right: 0px //** diff --git a/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass b/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass index 88ea604f..7950c836 100644 --- a/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass +++ b/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass @@ -10,7 +10,7 @@ padding: 0px display: inline -// makes an inlin list that is comma delimited. +// makes an inline list that is comma delimited. // use of this recipe is not recommended at this time due to browser support issues. // // use of :content and :after is not fully supported in all browsers. diff --git a/lib/compass.rb b/lib/compass.rb index aeae12dd..3566fb94 100644 --- a/lib/compass.rb +++ b/lib/compass.rb @@ -17,6 +17,6 @@ module Compass module_function :base_directory, :lib_directory end -%w(configuration frameworks app_integration).each do |lib| +%w(configuration frameworks app_integration actions compiler).each do |lib| require "compass/#{lib}" end diff --git a/lib/compass/app_integration/rails.rb b/lib/compass/app_integration/rails.rb index 668fbd42..0e5c6a84 100644 --- a/lib/compass/app_integration/rails.rb +++ b/lib/compass/app_integration/rails.rb @@ -20,6 +20,12 @@ module Compass extend(ConfigurationDefaults) end + def env + if rails_env = (defined?(::Rails) ? ::Rails.env : (defined?(RAILS_ENV) ? RAILS_ENV : nil)) + rails_env.production? ? :production : :development + end + end + end end end diff --git a/lib/compass/app_integration/rails/action_controller.rb b/lib/compass/app_integration/rails/actionpack2/action_controller.rb similarity index 100% rename from lib/compass/app_integration/rails/action_controller.rb rename to lib/compass/app_integration/rails/actionpack2/action_controller.rb diff --git a/lib/compass/app_integration/rails/sass_plugin.rb b/lib/compass/app_integration/rails/actionpack2/sass_plugin.rb similarity index 100% rename from lib/compass/app_integration/rails/sass_plugin.rb rename to lib/compass/app_integration/rails/actionpack2/sass_plugin.rb diff --git a/lib/compass/app_integration/rails/urls.rb b/lib/compass/app_integration/rails/actionpack2/urls.rb similarity index 100% rename from lib/compass/app_integration/rails/urls.rb rename to lib/compass/app_integration/rails/actionpack2/urls.rb diff --git a/lib/compass/app_integration/rails/installer.rb b/lib/compass/app_integration/rails/installer.rb index a81e2469..41072844 100644 --- a/lib/compass/app_integration/rails/installer.rb +++ b/lib/compass/app_integration/rails/installer.rb @@ -80,9 +80,12 @@ module Compass end def config_contents + "# This configuration file works with both the Compass command line tool and within Rails.\n" + Compass.configuration.serialize do |prop, value| if prop == :project_path "project_path = RAILS_ROOT if defined?(RAILS_ROOT)\n" + elsif prop == :environment + "environment = Compass::AppIntegration::Rails.env\n" elsif prop == :output_style "" end @@ -91,11 +94,11 @@ module Compass def initializer_contents %Q{require 'compass' - # If you have any compass plugins, require them here. - Compass.configuration.parse(File.join(RAILS_ROOT, "config", "compass.rb")) - Compass.configuration.environment = (defined?(Rails) ? Rails.env : RAILS_ENV).to_sym - Compass.configure_sass_plugin! - } + |rails_root = (defined?(Rails) ? Rails.root : RAILS_ROOT).to_s + |Compass.add_project_configuration(File.join(rails_root, "config", "compass.rb")) + |Compass.configure_sass_plugin! + |Compass.handle_configuration_change! + |}.gsub(/^\s+\|/,'') end def stylesheet_prefix diff --git a/lib/compass/app_integration/rails/runtime.rb b/lib/compass/app_integration/rails/runtime.rb index 82a353d1..a3ac8dfa 100644 --- a/lib/compass/app_integration/rails/runtime.rb +++ b/lib/compass/app_integration/rails/runtime.rb @@ -1,10 +1,20 @@ unless defined?(Compass::RAILS_LOADED) Compass::RAILS_LOADED = true - - %w(action_controller sass_plugin urls).each do |lib| - require "compass/app_integration/rails/#{lib}" + begin + require 'action_pack/version' + if ActionPack::VERSION::MAJOR >= 3 + # TODO figure something out so image_path works with rails integration + else + %w(action_controller sass_plugin urls).each do |lib| + require "compass/app_integration/rails/actionpack2/#{lib}" + end + end + rescue LoadError => e + $stderr.puts "Compass could not access the rails environment." + rescue NameError => e + $stderr.puts "Compass could not access the rails environment." end - + # Wierd that this has to be re-included to pick up sub-modules. Ruby bug? class Sass::Script::Functions::EvaluationContext include Sass::Script::Functions diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index b7245ec2..39298999 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -12,9 +12,7 @@ module Compass Compass.add_project_configuration(:project_type => options.delete(:project_type)) end Compass.add_configuration(options, 'command_line') - if File.exists?(Compass.configuration.extensions_path) - Compass::Frameworks.discover(Compass.configuration.extensions_path) - end + Compass.discover_extensions! Compass.add_configuration(installer.completed_configuration, 'installer') end diff --git a/lib/compass/commands/project_base.rb b/lib/compass/commands/project_base.rb index 5d5c3312..97fb8f39 100644 --- a/lib/compass/commands/project_base.rb +++ b/lib/compass/commands/project_base.rb @@ -23,9 +23,7 @@ module Compass def configure! add_project_configuration - if File.exists?(Compass.configuration.extensions_path) - Compass::Frameworks.discover(Compass.configuration.extensions_path) - end + Compass.discover_extensions! end def add_project_configuration diff --git a/lib/compass/commands/write_configuration.rb b/lib/compass/commands/write_configuration.rb index acf60301..bc7d6988 100644 --- a/lib/compass/commands/write_configuration.rb +++ b/lib/compass/commands/write_configuration.rb @@ -59,8 +59,11 @@ module Compass end end else - directory File.dirname(options[:configuration_file]) - installer.write_configuration_files(options[:configuration_file]) + config_file = options[:configuration_file] + config_file ||= Compass.detect_configuration_file + config_file ||= Compass::Configuration::Helpers::KNOWN_CONFIG_LOCATIONS.first + directory File.dirname(config_file) + installer.write_configuration_files(config_file) end end diff --git a/lib/compass/compiler.rb b/lib/compass/compiler.rb index 2c626439..ed33b808 100644 --- a/lib/compass/compiler.rb +++ b/lib/compass/compiler.rb @@ -58,6 +58,13 @@ module Compass nil end + def clean! + FileUtils.rm_rf options[:cache_location] + css_files.each do |css_file| + FileUtils.rm_f css_file + end + end + def run if new_config? # Wipe out the cache and force compilation if the configuration has changed. diff --git a/lib/compass/configuration/adapters.rb b/lib/compass/configuration/adapters.rb index 01929daf..0be86dc3 100644 --- a/lib/compass/configuration/adapters.rb +++ b/lib/compass/configuration/adapters.rb @@ -3,7 +3,7 @@ module Compass # The adapters module provides methods that make configuration data from a compass project # adapt to various consumers of configuration data module Adapters - def to_compiler_arguments(additional_options) + def to_compiler_arguments(additional_options = {}) [project_path, sass_path, css_path, to_sass_engine_options.merge(additional_options)] end @@ -19,8 +19,8 @@ module Compass plugin_opts = {:template_location => locations} plugin_opts[:style] = output_style if output_style plugin_opts[:line_comments] = line_comments - plugin_opts[:cache] = cache - plugin_opts[:cache_location] = cache_path + plugin_opts[:cache] = cache unless cache.nil? + plugin_opts[:cache_location] = cache_path unless cache_path.nil? plugin_opts.merge!(sass_options || {}) plugin_opts end diff --git a/lib/compass/configuration/defaults.rb b/lib/compass/configuration/defaults.rb index dadc0f39..483276da 100644 --- a/lib/compass/configuration/defaults.rb +++ b/lib/compass/configuration/defaults.rb @@ -2,6 +2,10 @@ module Compass module Configuration module Defaults + def default_project_path + "." + end + def default_project_type :stand_alone end diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb index d1d983bb..b9884fd0 100644 --- a/lib/compass/configuration/helpers.rb +++ b/lib/compass/configuration/helpers.rb @@ -31,6 +31,7 @@ module Compass if config.is_a?(Compass::Configuration::Data) config elsif config.respond_to?(:read) + filename ||= config.to_s if config.is_a?(Pathname) Compass::Configuration::Data.new_from_string(config.read, filename) elsif config.is_a?(Hash) Compass::Configuration::Data.new(filename, config) @@ -88,6 +89,12 @@ module Compass end end + def discover_extensions! + if File.exists?(configuration.extensions_path) + Compass::Frameworks.discover(configuration.extensions_path) + end + end + # Returns a full path to the relative path to the project directory def projectize(path, project_path = nil) project_path ||= configuration.project_path @@ -112,6 +119,15 @@ module Compass possible_files.detect{|f| File.exists?(f)} end + def handle_configuration_change! + if (compiler = Compass.compiler).new_config? + compiler.clean! + end + end + + def compiler + Compass::Compiler.new(*Compass.configuration.to_compiler_arguments) + end end end diff --git a/lib/compass/configuration/inheritance.rb b/lib/compass/configuration/inheritance.rb index 255749c2..18884d3d 100644 --- a/lib/compass/configuration/inheritance.rb +++ b/lib/compass/configuration/inheritance.rb @@ -145,13 +145,17 @@ module Compass end end - def debug + def chain instances = [self] instances << instances.last.inherited_data while instances.last.inherited_data + instances + end + + def debug normalized_attrs = {} ATTRIBUTES.each do |prop| values = [] - instances.each do |instance| + chain.each do |instance| values << { :raw => (instance.send("raw_#{prop}") rescue nil), :value => (instance.send("#{prop}_without_default") rescue nil), diff --git a/lib/compass/configuration/serialization.rb b/lib/compass/configuration/serialization.rb index c4c1fb27..902e7556 100644 --- a/lib/compass/configuration/serialization.rb +++ b/lib/compass/configuration/serialization.rb @@ -10,7 +10,7 @@ module Compass module ClassMethods def new_from_file(config_file) data = Data.new(config_file) - data.parse(config_file) + data._parse(config_file) data end @@ -22,8 +22,12 @@ module Compass end module InstanceMethods - # parses a configuration file which is a ruby script def parse(config_file) + raise Compass::Error, "Compass.configuration.parse(filename) has been removed. Please call Compass.add_project_configuration(filename) instead." + end + + # parses a configuration file which is a ruby script + def _parse(config_file) unless File.readable?(config_file) raise Compass::Error, "Configuration file, #{config_file}, not found or not readable." end @@ -37,6 +41,7 @@ module Compass eval(contents, bind, filename) ATTRIBUTES.each do |prop| value = eval(prop.to_s, bind) rescue nil + value = value.to_s if value.is_a?(Pathname) self.send("#{prop}=", value) unless value.nil? end if @added_import_paths @@ -73,7 +78,7 @@ module Compass def serialize_property(prop, value) %Q(#{prop} = #{value.inspect}\n) end - + def issue_deprecation_warnings if http_images_path == :relative $stderr.puts "DEPRECATION WARNING: Please set relative_assets = true to enable relative paths." diff --git a/lib/compass/exec.rb b/lib/compass/exec.rb index 664db9d4..08b15e8e 100644 --- a/lib/compass/exec.rb +++ b/lib/compass/exec.rb @@ -6,7 +6,11 @@ require 'compass/actions' require 'compass/installers' require 'compass/commands' require 'rbconfig' -require 'win32console' if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ +begin + require 'win32console' if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ +rescue LoadError + $boring = true +end module Compass::Exec end diff --git a/lib/compass/frameworks.rb b/lib/compass/frameworks.rb index bfe821f8..fef3e333 100644 --- a/lib/compass/frameworks.rb +++ b/lib/compass/frameworks.rb @@ -27,11 +27,20 @@ module Compass end end + def detect_registration + @registered = nil + yield + @registered + ensure + @registered = nil + end + def register(name, *arguments) + @registered = Framework.new(name, *arguments) if idx = ALL.index(self[name]) - ALL[idx] = Framework.new(name, *arguments) + ALL[idx] = @registered else - ALL << Framework.new(name, *arguments) + ALL << @registered end end @@ -54,9 +63,10 @@ module Compass File.join(directory, File.basename(directory)+".rb") ] loader = loaders.detect{|l| File.exists?(l)} - if loader - require loader - else + registered_framework = detect_registration do + require loader if loader + end + unless registered_framework register File.basename(directory), directory end end diff --git a/lib/compass/logger.rb b/lib/compass/logger.rb index c0fd5ffd..bd6c97a1 100644 --- a/lib/compass/logger.rb +++ b/lib/compass/logger.rb @@ -2,12 +2,13 @@ module Compass class Logger - DEFAULT_ACTIONS = [:directory, :exists, :remove, :create, :overwrite, :compile, :error, :identical] + DEFAULT_ACTIONS = [:directory, :exists, :remove, :create, :overwrite, :compile, :error, :identical, :warning] COLORS = { :clear => 0, :red => 31, :green => 32, :yellow => 33 } ACTION_COLORS = { :error => :red, + :warning => :yellow, :compile => :green, :overwrite => :yellow, :create => :green, @@ -46,7 +47,11 @@ module Compass def color(c) if Compass.configuration.color_output && c && COLORS.has_key?(c.to_sym) - "\e[#{COLORS[c.to_sym]}m" + if defined?($boring) && $boring + "" + else + "\e[#{COLORS[c.to_sym]}m" + end else "" end diff --git a/lib/compass/sass_extensions/functions.rb b/lib/compass/sass_extensions/functions.rb index c33a3012..cc827748 100644 --- a/lib/compass/sass_extensions/functions.rb +++ b/lib/compass/sass_extensions/functions.rb @@ -1,7 +1,7 @@ module Compass::SassExtensions::Functions end -%w(selectors enumerate urls display inline_image color_stop font_files).each do |func| +%w(selectors enumerate urls display inline_image image_size gradient_support font_files).each do |func| require "compass/sass_extensions/functions/#{func}" end @@ -11,7 +11,8 @@ module Sass::Script::Functions include Compass::SassExtensions::Functions::Urls include Compass::SassExtensions::Functions::Display include Compass::SassExtensions::Functions::InlineImage - include Compass::SassExtensions::Functions::ColorStop + include Compass::SassExtensions::Functions::ImageSize + include Compass::SassExtensions::Functions::GradientSupport::Functions include Compass::SassExtensions::Functions::FontFiles end diff --git a/lib/compass/sass_extensions/functions/color_stop.rb b/lib/compass/sass_extensions/functions/color_stop.rb deleted file mode 100644 index a0902dfe..00000000 --- a/lib/compass/sass_extensions/functions/color_stop.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Compass::SassExtensions::Functions::ColorStop - def color_stop(*args) - raise Sass::SyntaxError, "An even number of arguments must be passed to color-stop()" unless args.size % 2 == 0 - stops = [] - while args.size > 0 - stops << "color-stop(#{args.shift}, #{args.shift})" - end - Sass::Script::String.new(stops.join(", ")) - end -end diff --git a/lib/compass/sass_extensions/functions/gradient_support.rb b/lib/compass/sass_extensions/functions/gradient_support.rb new file mode 100644 index 00000000..f4fa9d42 --- /dev/null +++ b/lib/compass/sass_extensions/functions/gradient_support.rb @@ -0,0 +1,195 @@ +module Compass::SassExtensions::Functions::GradientSupport + + class List < Sass::Script::Literal + attr_accessor :values + def initialize(*values) + self.values = values + end + def inspect + values.map{|v| v.inspect}.join(", ") + end + def to_s + inspect + end + end + + class ColorStop < Sass::Script::Literal + attr_accessor :color, :stop + def initialize(color, stop = nil) + self.color, self.stop = color, stop + end + def inspect + to_s + end + def to_s + s = color.inspect.dup + if stop + s << " " + if stop.unitless? + s << stop.times(Sass::Script::Number.new(100, ["%"])).inspect + else + s << stop.inspect + end + end + s + end + end + + module Functions + # returns the opposite position of a side or corner. + def grad_opposite_position(position) + opposite = position.value.split(/ +/).map do |pos| + case pos + when "top" then "bottom" + when "bottom" then "top" + when "left" then "right" + when "right" then "left" + when "center" then "center" + else + raise Sass::SyntaxError, "Cannot determine the opposite of #{pos}" + end + end + Sass::Script::String.new(opposite.join(" ")) + end + + # returns color-stop() calls for use in webkit. + def grad_color_stops(color_list) + assert_list(color_list) + normalize_stops!(color_list) + max = color_list.values.last.stop + color_stops = color_list.values.map do |pos| + # have to convert absolute units to percentages for use in color stop functions. + stop = pos.stop + stop = stop.div(max).times(Sass::Script::Number.new(100,["%"])) if stop.numerator_units == max.numerator_units + "color-stop(#{stop.inspect}, #{pos.color.inspect})" + end + Sass::Script::String.new(color_stops.join(", ")) + end + + # returns the end position of the gradient from the color stop + def grad_end_position(color_list, radial = Sass::Script::Bool.new(false)) + assert_list(color_list) + default = Sass::Script::Number.new(100) + grad_position(color_list, Sass::Script::Number.new(color_list.values.size), default, radial) + end + + def grad_position(color_list, index, default, radial = Sass::Script::Bool.new(false)) + assert_list(color_list) + stop = color_list.values[index.value - 1].stop + if stop && radial.to_bool + orig_stop = stop + if stop.unitless? + if stop.value <= 1 + # A unitless number is assumed to be a percentage when it's between 0 and 1 + stop = stop.times(Sass::Script::Number.new(100, ["%"])) + else + # Otherwise, a unitless number is assumed to be in pixels + stop = stop.times(Sass::Script::Number.new(1, ["px"])) + end + end + if stop.numerator_units == ["%"] && color_list.values.last.stop && color_list.values.last.stop.numerator_units == ["px"] + stop = stop.times(color_list.values.last.stop).div(Sass::Script::Number.new(100, ["%"])) + end + Compass::Logger.new.record(:warning, "Webkit only supports pixels for the start and end stops for radial gradients. Got: #{orig_stop}") if stop.numerator_units != ["px"] + stop.div(Sass::Script::Number.new(1, stop.numerator_units, stop.denominator_units)) + elsif stop + stop + else + default + end + end + + # the given a position, return a point in percents + def grad_point(position) + position = position.value + position = if position[" "] + if position =~ /(top|bottom|center) (left|right|center)/ + "#{$2} #{$1}" + else + position + end + else + case position + when /top|bottom/ + "left #{position}" + when /left|right/ + "#{position} top" + else + position + end + end + Sass::Script::String.new(position. + gsub(/top/, "0%"). + gsub(/bottom/, "100%"). + gsub(/left/,"0%"). + gsub(/right/,"100%"). + gsub(/center/, "50%")) + end + + def color_stops(*args) + List.new(*args.map do |arg| + case arg + when Sass::Script::Color + ColorStop.new(arg) + when Sass::Script::String + # We get a string as the result of concatenation + # So we have to reparse the expression + color = stop = nil + expr = Sass::Script::Parser.parse(arg.value, 0, 0) + case expr + when Sass::Script::Color + color = expr + when Sass::Script::Funcall + color = expr + when Sass::Script::Operation + unless expr.instance_variable_get("@operator") == :concat + # This should never happen. + raise Sass::SyntaxError, "Couldn't parse a color stop from: #{arg.value}" + end + color = expr.instance_variable_get("@operand1") + stop = expr.instance_variable_get("@operand2") + else + raise Sass::SyntaxError, "Couldn't parse a color stop from: #{arg.value}" + end + ColorStop.new(color, stop) + else + raise Sass::SyntaxError, "Not a valid color stop: #{arg}" + end + end) + end + private + def normalize_stops!(color_list) + positions = color_list.values + # fill in the start and end positions, if unspecified + positions.first.stop = Sass::Script::Number.new(0) unless positions.first.stop + positions.last.stop = Sass::Script::Number.new(100, ["%"]) unless positions.last.stop + # fill in empty values + for i in 0...positions.size + if positions[i].stop.nil? + num = 2.0 + for j in (i+1)...positions.size + if positions[j].stop + positions[i].stop = positions[i-1].stop.plus((positions[j].stop.minus(positions[i-1].stop)).div(Sass::Script::Number.new(num))) + break + else + num += 1 + end + end + end + end + # normalize unitless numbers + positions.each do |pos| + if pos.stop.unitless? && pos.stop.value <= 1 + pos.stop = pos.stop.times(Sass::Script::Number.new(100, ["%"])) + elsif pos.stop.unitless? + pos.stop = pos.stop.times(Sass::Script::Number.new(1, ["px"])) + end + end + nil + end + def assert_list(value) + return if value.is_a?(List) + raise ArgumentError.new("#{value.inspect} is not a list of color stops. Expected: color_stops( ?, ...)") + end + end +end diff --git a/lib/compass/sass_extensions/functions/image_size.rb b/lib/compass/sass_extensions/functions/image_size.rb new file mode 100644 index 00000000..c143faa8 --- /dev/null +++ b/lib/compass/sass_extensions/functions/image_size.rb @@ -0,0 +1,102 @@ +module Compass::SassExtensions::Functions::ImageSize + # Returns the width of the image relative to the images directory + def image_width(image_file) + image_path = real_path(image_file) + width = ImageProperties.new(image_path).size.first + Sass::Script::Number.new(width,["px"]) + end + + # Returns the height of the image relative to the images directory + def image_height(image_file) + image_path = real_path(image_file) + height = ImageProperties.new(image_path).size.last + Sass::Script::Number.new(height, ["px"]) + end + +private + def real_path(image_file) + path = image_file.value + # Compute the real path to the image on the file stystem if the images_dir is set. + if Compass.configuration.images_path + File.join(Compass.configuration.images_path, path) + else + File.join(Compass.configuration.project_path, path) + end + end + + class ImageProperties + def initialize(file) + @file = file + @file_type = File.extname(@file)[1..-1] + end + + def size + @dimensions ||= send(:"get_size_for_#{@file_type}") + rescue NoMethodError + raise Sass::SyntaxError, "Unrecognized file type: #{@file_type}" + end + + private + def get_size_for_png + IO.read(@file)[0x10..0x18].unpack('NN') + end + + def get_size_for_gif + size = IO.read(@file)[6..10].unpack('SS') + end + + def get_size_for_jpg + get_size_for_jpeg + end + + def get_size_for_jpeg + jpeg = JPEG.new(@file) + [jpeg.width, jpeg.height] + end + end + + class JPEG + attr_reader :width, :height, :bits + + def initialize(file) + if file.kind_of? IO + examine(file) + else + File.open(file, 'rb') { |io| examine(io) } + end + end + + private + def examine(io) + class << io + unless method_defined?(:readbyte) + def readbyte + getc + end + end + def readint; (readbyte << 8) + readbyte; end + def readframe; read(readint - 2); end + def readsof; [readint, readbyte, readint, readint, readbyte]; end + def next + c = readbyte while c != 0xFF + c = readbyte while c == 0xFF + c + end + end + + raise 'malformed JPEG!' unless io.readbyte == 0xFF && io.readbyte == 0xD8 # SOI + + while marker = io.next + case marker + when 0xC0..0xC3, 0xC5..0xC7, 0xC9..0xCB, 0xCD..0xCF # SOF markers + length, @bits, @height, @width, components = io.readsof + raise 'malformed JPEG' unless length == 8 + components * 3 + when 0xD9, 0xDA then break # EOI, SOS + when 0xFE then @comment = io.readframe # COM + when 0xE1 then io.readframe # APP1, contains EXIF tag + else io.readframe # ignore frame + end + end + end +end +end diff --git a/test/compass_test.rb b/test/compass_test.rb index aff2388a..665d0070 100644 --- a/test/compass_test.rb +++ b/test/compass_test.rb @@ -42,7 +42,7 @@ class CompassTest < Test::Unit::TestCase each_css_file(proj.css_path) do |css_file| assert_no_errors css_file, 'compass' end - assert_renders_correctly :reset, :layout, :utilities + assert_renders_correctly :reset, :layout, :utilities, :gradients, :image_size end end diff --git a/test/configuration_test.rb b/test/configuration_test.rb index d13c528e..1fca5d1a 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -93,6 +93,36 @@ css_dir = "css" # To enable relative paths to assets via compass helper functions. Uncomment: # relative_assets = true additional_import_paths = ["../foo", "/path/to/my/framework"] +EXPECTED + assert_equal "/", Compass.configuration.http_path + assert_equal expected_serialization.split("\n"), Compass.configuration.serialize.split("\n") + end + + def test_config_with_pathname + contents = StringIO.new(<<-CONFIG) + http_path = "/" + project_path = Pathname.new("/home/chris/my_compass_project") + css_dir = "css" + additional_import_paths = ["../foo"] + add_import_path "/path/to/my/framework" + CONFIG + + Compass.add_configuration(contents, "test_additional_import_paths") + + assert Compass.configuration.to_sass_engine_options[:load_paths].include?("/home/chris/my_compass_project/../foo") + assert Compass.configuration.to_sass_engine_options[:load_paths].include?("/path/to/my/framework"), Compass.configuration.to_sass_engine_options[:load_paths].inspect + assert_equal "/home/chris/my_compass_project/css/framework", Compass.configuration.to_sass_plugin_options[:template_location]["/path/to/my/framework"] + assert_equal "/home/chris/my_compass_project/css/foo", Compass.configuration.to_sass_plugin_options[:template_location]["/home/chris/my_compass_project/../foo"] + + expected_serialization = <