diff --git a/.gitignore b/.gitignore index 8d7173a5..ecc3e275 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ doc-src/.bundle attic devbin .rvmrc +*.rbc diff --git a/Gemfile b/Gemfile index 47aa9a44..b102fdf4 100644 --- a/Gemfile +++ b/Gemfile @@ -1,17 +1,27 @@ source :rubygems -gem "compass", :path => "." +gemspec + gem "cucumber", "~> 0.9.2" gem "rspec", "~>2.0.0" gem "rails", "~>3.0.0.rc" gem "compass-validator", "3.0.0" gem "css_parser", "~> 1.0.1" -gem "sass" -gem "haml", "~> 3.1.alpha" +gem "sass", "3.1.0.alpha.263" +gem "haml", "~> 3.1.0.alpha" gem "rcov" gem "rubyzip" gem "livereload" -gem "chunky_png", "~> 0.10.1" +gem "rb-fsevent" gem "ruby-prof" unless RUBY_PLATFORM == "java" + +gem 'autotest' +gem 'autotest-fsevent' +gem 'fakefs', :git => 'git://github.com/johnbintz/fakefs.git' +gem 'mocha' +gem 'timecop' + + + diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..ec2d4004 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,153 @@ +GIT + remote: git://github.com/johnbintz/fakefs.git + revision: 005ddaaeb2b2881391c31ac9846a55ce5a42c206 + specs: + fakefs (0.3.1) + +PATH + remote: . + specs: + compass (0.11.1) + chunky_png (~> 1.1.1) + fssm (>= 0.2.7) + sass (>= 3.1.0.alpha.249) + +GEM + remote: http://rubygems.org/ + specs: + ZenTest (4.5.0) + abstract (1.0.0) + actionmailer (3.0.7) + actionpack (= 3.0.7) + mail (~> 2.2.15) + actionpack (3.0.7) + activemodel (= 3.0.7) + activesupport (= 3.0.7) + builder (~> 2.1.2) + erubis (~> 2.6.6) + i18n (~> 0.5.0) + rack (~> 1.2.1) + rack-mount (~> 0.6.14) + rack-test (~> 0.5.7) + tzinfo (~> 0.3.23) + activemodel (3.0.7) + activesupport (= 3.0.7) + builder (~> 2.1.2) + i18n (~> 0.5.0) + activerecord (3.0.7) + activemodel (= 3.0.7) + activesupport (= 3.0.7) + arel (~> 2.0.2) + tzinfo (~> 0.3.23) + activeresource (3.0.7) + activemodel (= 3.0.7) + activesupport (= 3.0.7) + activesupport (3.0.7) + addressable (2.2.5) + arel (2.0.9) + autotest (4.4.6) + ZenTest (>= 4.4.1) + autotest-fsevent (0.2.5) + sys-uname + builder (2.1.2) + chunky_png (1.1.1) + compass-validator (3.0.0) + css_parser (1.0.1) + cucumber (0.9.4) + builder (~> 2.1.2) + diff-lcs (~> 1.1.2) + gherkin (~> 2.2.9) + json (~> 1.4.6) + term-ansicolor (~> 1.0.5) + diff-lcs (1.1.2) + em-dir-watcher (0.9.4) + em-websocket (0.2.1) + addressable (>= 2.1.1) + eventmachine (>= 0.12.9) + erubis (2.6.6) + abstract (>= 1.0.0) + eventmachine (0.12.10) + fssm (0.2.7) + gherkin (2.2.9) + json (~> 1.4.6) + term-ansicolor (~> 1.0.5) + haml (3.1.0) + i18n (0.5.0) + json (1.4.6) + livereload (1.6) + em-dir-watcher (>= 0.1) + em-websocket (>= 0.1.2) + ruby-json (>= 1.1.2) + mail (2.2.17) + activesupport (>= 2.3.6) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.16) + mocha (0.9.12) + polyglot (0.3.1) + rack (1.2.2) + rack-mount (0.6.14) + rack (>= 1.0.0) + rack-test (0.5.7) + rack (>= 1.0) + rails (3.0.7) + actionmailer (= 3.0.7) + actionpack (= 3.0.7) + activerecord (= 3.0.7) + activeresource (= 3.0.7) + activesupport (= 3.0.7) + bundler (~> 1.0) + railties (= 3.0.7) + railties (3.0.7) + actionpack (= 3.0.7) + activesupport (= 3.0.7) + rake (>= 0.8.7) + thor (~> 0.14.4) + rake (0.8.7) + rb-fsevent (0.4.0) + rcov (0.9.9) + rspec (2.0.1) + rspec-core (~> 2.0.1) + rspec-expectations (~> 2.0.1) + rspec-mocks (~> 2.0.1) + rspec-core (2.0.1) + rspec-expectations (2.0.1) + diff-lcs (>= 1.1.2) + rspec-mocks (2.0.1) + rspec-core (~> 2.0.1) + rspec-expectations (~> 2.0.1) + ruby-json (1.1.2) + ruby-prof (0.10.5) + rubyzip (0.9.4) + sass (3.1.0.alpha.263) + sys-uname (0.8.5) + term-ansicolor (1.0.5) + thor (0.14.6) + timecop (0.3.5) + treetop (1.4.9) + polyglot (>= 0.3.1) + tzinfo (0.3.26) + +PLATFORMS + ruby + +DEPENDENCIES + autotest + autotest-fsevent + compass! + compass-validator (= 3.0.0) + css_parser (~> 1.0.1) + cucumber (~> 0.9.2) + fakefs! + haml (~> 3.1.0.alpha) + livereload + mocha + rails (~> 3.0.0.rc) + rb-fsevent + rcov + rspec (~> 2.0.0) + ruby-prof + rubyzip + sass (= 3.1.0.alpha.263) + timecop diff --git a/VERSION.yml b/VERSION.yml index a5fe2d1b..99382bed 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,5 +1,5 @@ --- :major: 0 :minor: 11 -:state: alpha -:build: 4 +:build: 1 +:name: Antares diff --git a/autotest/discover.rb b/autotest/discover.rb new file mode 100644 index 00000000..ee7f82c5 --- /dev/null +++ b/autotest/discover.rb @@ -0,0 +1,5 @@ +Autotest.add_discovery { 'rspec2' } + + + + diff --git a/compass.gemspec b/compass.gemspec index 9e7f1127..87e2436f 100644 --- a/compass.gemspec +++ b/compass.gemspec @@ -4,20 +4,20 @@ require File.join(path, 'compass/version') Gem::Specification.new do |gemspec| gemspec.name = "compass" gemspec.version = Compass::VERSION # Update the VERSION.yml file to set this. - gemspec.date = "#{Time.now.year}-#{Time.now.month}-#{Time.now.day}" # Automatically update for each build gemspec.description = "Compass is a Sass-based Stylesheet Framework that streamlines the creation and maintainance of CSS." gemspec.homepage = "http://compass-style.org" - gemspec.authors = ["Chris Eppstein", "Eric A. Meyer", "Brandon Mathis", "Nico Hagenburger"] + gemspec.authors = ["Chris Eppstein", "Eric A. Meyer", "Brandon Mathis", "Nico Hagenburger", "Scott Davis"] gemspec.email = "chris@eppsteins.net" - gemspec.default_executable = "compass" + #gemspec.default_executable = "compass" #deprecated gemspec.executables = %w(compass) - gemspec.has_rdoc = false + #gemspec.has_rdoc = false #deprecated gemspec.require_paths = %w(lib) gemspec.rubygems_version = "1.3.5" gemspec.summary = %q{A Real Stylesheet Framework} - gemspec.add_dependency 'sass', '>= 3.1.0.alpha.50' - gemspec.add_dependency 'chunky_png', '~> 0.10.3' + gemspec.add_dependency 'sass', '~> 3.1' + gemspec.add_dependency 'chunky_png', '~> 1.1' + gemspec.add_dependency 'fssm', '>= 0.2.7' gemspec.files = %w(README.markdown LICENSE.markdown VERSION.yml Rakefile) gemspec.files += Dir.glob("bin/*") diff --git a/doc-src/Gemfile b/doc-src/Gemfile index aea55426..02cd4b7f 100644 --- a/doc-src/Gemfile +++ b/doc-src/Gemfile @@ -8,14 +8,15 @@ gem 'mime-types' gem 'serve', "1.0.0" gem 'nokogiri' gem 'coderay' -gem 'sass', ">= 3.1.0.alpha.50" -gem 'fssm', '0.1.2' +gem 'sass', ">= 3.1.0.alpha.249" gem 'haml', ">= 3.1.0.alpha.36" gem 'rake' gem 'compass', :path => ".." gem 'compass-susy-plugin', ">=0.7.0.pre8" gem 'css-slideshow', "0.2.0" gem 'json' -gem 'css_parser' +gem 'css_parser', "1.0.1" gem 'ruby-prof' +gem 'rb-fsevent' + diff --git a/doc-src/Gemfile.lock b/doc-src/Gemfile.lock index ac01405d..669c3b15 100644 --- a/doc-src/Gemfile.lock +++ b/doc-src/Gemfile.lock @@ -8,40 +8,42 @@ GIT PATH remote: .. specs: - compass (0.11.alpha.4.d67a43a) - chunky_png (~> 0.10.3) - sass (>= 3.1.0.alpha.50) + compass (0.11.1.63cae60) + chunky_png (~> 1.1) + fssm (>= 0.2.7) + sass (~> 3.1) GEM remote: http://rubygems.org/ specs: - activesupport (3.0.1) - chunky_png (0.10.5) - coderay (0.9.5) - compass-susy-plugin (0.8.1) - compass (>= 0.10.0) + activesupport (3.0.7) + chunky_png (1.1.1) + coderay (0.9.7) + compass-susy-plugin (0.9.beta.3) + compass (>= 0.11.beta.3) cri (1.0.1) css-slideshow (0.2.0) compass (>= 0.10.0.rc3) - css_parser (1.1.4) - fssm (0.1.2) - haml (3.1.0.alpha.36) + css_parser (1.0.1) + fssm (0.2.7) + haml (3.1.0) i18n (0.4.2) - json (1.4.6) + json (1.5.1) mime-types (1.16) - nokogiri (1.4.3.1) - rack (1.2.1) + nokogiri (1.4.4) + rack (1.2.2) rake (0.8.7) - rdiscount (1.6.5) + rb-fsevent (0.4.0) + rdiscount (1.6.8) ruby-prof (0.9.2) - sass (3.1.0.alpha.214) + sass (3.1.0) serve (1.0.0) activesupport (~> 3.0.1) i18n (~> 0.4.1) rack (~> 1.2.1) tzinfo (~> 0.3.23) - thor (0.14.4) - tzinfo (0.3.23) + thor (0.14.6) + tzinfo (0.3.26) PLATFORMS ruby @@ -51,8 +53,7 @@ DEPENDENCIES compass! compass-susy-plugin (>= 0.7.0.pre8) css-slideshow (= 0.2.0) - css_parser - fssm (= 0.1.2) + css_parser (= 1.0.1) haml (>= 3.1.0.alpha.36) json mime-types @@ -60,8 +61,9 @@ DEPENDENCIES nokogiri rack rake + rb-fsevent rdiscount ruby-prof - sass (>= 3.1.0.alpha.50) + sass (>= 3.1.0.alpha.249) serve (= 1.0.0) thor diff --git a/doc-src/README.markdown b/doc-src/README.markdown index 3d94feeb..c367c6b5 100644 --- a/doc-src/README.markdown +++ b/doc-src/README.markdown @@ -49,7 +49,7 @@ If you are adding an asset (E.g. image, css, javascript) place the file(s) in th Running the following command will generate a new example: - bundle exec thor generate:example blueprint/grid/simple/ + ./bin/thor generate:example blueprint/grid/simple/ An example consists of three files: @@ -74,7 +74,7 @@ After adding the example and adjusting the metadata, go to the reference page an Generate a reference file for a stylesheet: - bundle exec thor generate:reference ../frameworks/compass/stylesheets/_compass.sass + ./bin/thor generate:reference ../frameworks/compass/stylesheets/_compass.sass The item metadata (at the top of the file) provides some details about what stylesheet is being documented. For instance, here is the metadata for the blueprint color module item: @@ -143,15 +143,7 @@ Go to your fork of Compass on github. Your compass fork will be available on htt $ git clone git@github.com:**yourusername**/compass.git -### 3. Switch to the docs branch - -To work on the docs, you need to do a checkout of the docs branch - - $ git checkout docs - -(A list branches can be accessed through `git branch` with no arguments) - -### 4. Don't forget: bundler! +### 3. Don't forget: bundler! If you haven't yet done so, install bundler: @@ -160,30 +152,28 @@ If you haven't yet done so, install bundler: Bundle the gems for this application: $ cd doc-src - $ bundle install + $ bundle install --binstubs -### 6. Compile the docs +### 4. Compile the docs -To compile (and auto recompile) and preview the site in your browser: (make sure you run nanoc3/aco from the doc-src directory) +To compile (and auto recompile) and preview the site in your browser: (make sure you run nanoc3 aco from the doc-src directory) $ cd doc-src - $ export RUBYLIB="../lib" - $ bundle exec nanoc3 aco + $ ./bin/nanoc3 aco -Then open `http://localhost:3000/docs/` in your web browser. +Then open `http://localhost:3000/index.html` in your web browser. aco stands for autocompiler; the site will recompile every time you request a new page. -If you find `bundle exec nanoc3 aco` to be sluggish, try this alternative workflow: +If you find `./bin/nanoc3 aco` to be sluggish, try this alternative workflow: $ cd doc-src - $ export RUBYLIB="../lib" - $ bundle exec serve 3000 .. & - $ bundle exec rake watch + $ ./bin/serve 3000 output & + $ ./bin/rake watch It is recommended that you read the 5 minute [tutorial](http://nanoc.stoneship.org/tutorial/) on Nanoc. -### 7. Commit your changes to your Fork +### 5. Commit your changes to your Fork git commit -a git push @@ -202,4 +192,4 @@ Then get the new changes with fetch: And merge them with your local docs branch: - git merge chris/docs \ No newline at end of file + git merge chris \ No newline at end of file diff --git a/doc-src/Rakefile b/doc-src/Rakefile index 37ca4c55..b088a701 100644 --- a/doc-src/Rakefile +++ b/doc-src/Rakefile @@ -25,7 +25,7 @@ task :watch do rebuild_site = lambda do |base, relative| if relative && relative =~ /\.s[ac]ss/ - puts ">>> Change Detected to #{relative} : updating stylsheets <<<" + puts ">>> Change Detected to #{relative} : updating stylesheets <<<" system "bundle exec compass compile" else if !relative diff --git a/doc-src/Rules b/doc-src/Rules index 2be98d80..c5ba8d9e 100644 --- a/doc-src/Rules +++ b/doc-src/Rules @@ -47,6 +47,16 @@ compile '/reference/*/' do layout item[:layout] ? item[:layout] : "main" end +compile '/posts/*/' do + filter :erb + filter :rdiscount if item[:extension] == "markdown" + layout 'post' +end + +compile "/blog/atom/" do + filter :haml, :attr_wrapper => '"' +end + compile '*' do if item[:extension] == "markdown" filter :rdiscount @@ -56,6 +66,10 @@ compile '*' do layout item[:layout] ? item[:layout] : "main" end +route "/blog/atom/" do + "/blog/atom.xml" +end + route '/search-data/' do "#{SITE_ROOT}/javascripts"+item.identifier[0..-2]+".js" end @@ -89,6 +103,15 @@ route '/stylesheets/*/' do SITE_ROOT+item.identifier.chop + '.css' end +route '/posts/*/' do + if item.identifier =~ %r{^/posts/(\d{4})-(\d{2})-(\d{2})-(.*)/$} + "/blog/#{$1}/#{$2}/#{$3}/#{$4}/index.html" + else + puts "WARNING: malformed post name: #{item.identifier}" + nil + end +end + %w(markup stylesheet background).each do |ex_file| route "/examples/*/#{ex_file}/" do nil diff --git a/doc-src/assets/javascripts/install.js b/doc-src/assets/javascripts/install.js new file mode 100644 index 00000000..6b52b844 --- /dev/null +++ b/doc-src/assets/javascripts/install.js @@ -0,0 +1,87 @@ +function showInstallCommand() { + var cmd = $("#existence").val(); + var commands = []; + var notes = []; + var project_name = "<myproject>"; + var can_be_bare = true; + commands.push("$ gem install compass"); + if (cmd == "init") { + commands.push("$ cd " + project_name); + project_name = "."; + } + if ($("#app-type").val() == "rails") { + if (cmd == "create") { + commands.push("$ rails new " + project_name); + } + cmd = "init rails"; + can_be_bare = false; + } else if ($("#app-type").val() == "other") { + if (cmd == "init") { + cmd = "create"; + } + } else if ($("#app-type").val() == "stand-alone") { + if (cmd == "init") { + cmd = "install"; + can_be_bare = false; + } + } + var framework = $("#framework").val(); + var create_command; + if (cmd == "install") { + create_command = "$ compass install " + framework + " " + project_name; + } else { + create_command = "$ compass " + cmd + " " + project_name; + } + if (framework != "compass" && framework != "bare" && cmd != "install") { + create_command = create_command + " --using " + framework; + } else if (framework == "bare") { + if (can_be_bare) { + create_command = create_command + " --bare"; + } else { + notes.push("

You cannot create a bare project in this configuration. Feel free to remove any stylesheets that you don't want.

"); + } + } + if ($("#syntax").val() == "sass") { + create_command = create_command + " --syntax sass"; + } + if ($("#options").val() == "customized") { + $("#directories").show(); + create_command = create_command + + " --sass-dir \"" + $("#sassdir").val() + "\"" + + " --css-dir \"" + $("#cssdir").val() + "\"" + + " --javascripts-dir \"" + $("#jsdir").val() + "\"" + + " --images-dir \"" + $("#imagesdir").val() + "\""; + } else { + $("#directories").hide(); + } + commands.push(create_command); + var instructions = "
" + commands.join("\n") + "
"; + if (instructions.match(/</)) { + notes.push("

Note: Values indicated by <> are placeholders. Change them to suit your needs."); + } + $("#steps").html(instructions + notes.join("")); +} + +function attachMadlibBehaviors() { + $("#app-type").change(function(event) { + var val = $(event.target).val(); + if (val == "other") { + $("#options").val("customized"); + $(".madlib").addClass("customizable"); + } else if (val == "rails") { + $("#options").val("default"); + $(".madlib").removeClass("customizable"); + } else { + $(".madlib").addClass("customizable"); + } + }); + $("#existence, #app-type, #framework, #syntax, #options").change(showInstallCommand); + $(".madlib input").keyup(function(){setTimeout(showInstallCommand, 0.1)}); +} + +function setupMadlib() { + attachMadlibBehaviors(); + showInstallCommand(); +} + +$(setupMadlib); diff --git a/doc-src/authors.yml b/doc-src/authors.yml new file mode 100644 index 00000000..1f6fe407 --- /dev/null +++ b/doc-src/authors.yml @@ -0,0 +1,11 @@ +chris: + fullname: Chris Eppstein + byline_link: http://chriseppstein.github.com/ +brandon: + fullname: Brandon Mathis +eric: + fullname: Eric Meyer +nico: + fullname: Nico Hagenburger +scott: + fullname: Scott Davis diff --git a/doc-src/content/CHANGELOG-v0-11-beta.markdown b/doc-src/content/CHANGELOG-v0-11-beta.markdown new file mode 100644 index 00000000..127f0f24 --- /dev/null +++ b/doc-src/content/CHANGELOG-v0-11-beta.markdown @@ -0,0 +1,282 @@ +--- +title: Compass v0.11.0 Beta History +crumb: CHANGELOG +body_id: changelog +layout: article +--- + +0.11.beta.8 (UNRELEASED) +------------------------ + +* Created an official API to add configuration options to compass. + [More information](/help/tutorials/extending/). + +0.11.beta.7 (04/16/2011) +------------------------ +* Added support for the new webkit gradient syntax that matches the css3 specification. + Support for older webkit browsers remains enabled at this time. + To disable it, set `$support-for-original-webkit-gradients` to false. +* There is a new mixin for creating + [pure-css grid backgrounds](/reference/compass/layout/grid_background/) + for verifying grid alignment for both fixed and fluid grids. +* Add support for pixel-based gradients in the original webkit gradient syntax. +* Added a vertical rhythm function for calculating rhythms without returning a property. + +0.11.beta.6 (04/10/2011) +------------------------ +* Added support for degree-based linear and radial gradients (not yet supported for SVG gradients) +* Added opera prefix support for linear and radial gradients. +* The CSS3 `background` mixin's "simple" background that came + before the prefixed versions has been removed. If you + need to target css2 background it is recommended that you set a + the background property before calling the `background` mixin + or you can call the `background-with-css2-fallback` if you want + keep using compass's automatic simplification of the arguments. +* Bug fixes +* Fixed and issue with the compass gemspec in rubygems 1.7 +* Fixed a bug with sprite imports + +0.11.beta.5 (03/27/2011) +------------------------ + +### Compass Sprites + +[Magic Selectors](/help/tutorials/spriting/#magic-selectors) have been added + +Fixed a bug causing a stack level too deep in ruby 1.8.7 + +0.11.beta.4 (03/25/2011) +------------------------ + +* Extensions that are installed into ~/.compass/extensions will be automatically available to all your compass projects. + +### Compass Internals + +* Fixed a small bug in callbacks that was causing them to register twice +* The Sprite classes have been abstracted allowing for different engines +* Bumped chunky_png version to 1.1.0 +* Total rewrite of the sprite generation classes - thanks to [@johnbintz](https://github.com/johnbintz) for the help +* More Rspec tests + +0.11.beta.3 (03/15/2011) +------------------------ + +### Compass CSS3 + +* A new CSS3 mixin for [appearance](/reference/compass/css3/appearance/) was added. +* The font-face mixin has been updated again with the [syntax recommendations + from font-spring](http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax). + The API has not changed. + +### Compass Typography + +* Some text-based mixins have been moved from utilities to the new + typography module. The old imports are deprecated now. + Affected modules: utilities/links, utilities/lists, and utilities/text and + their sub-modules. +* There is a new typography module: [Vertical Rhythm](/reference/compass/typography/vertical_rhythm/). + This makes it easier to align the typography of your page to a common rhythm. + +### Compass Utilities + +* A new mixin `reset-float` is available in the [float module](/reference/compass/utilities/general/float/#mixin-reset-float) that makes it easier to reset the floats introduced from that module. +* A new mixin `reset-float` is available in the [float module](/reference/compass/utilities/general/float/#mixin-reset-float) that makes it easier to reset the floats introduced from that module. +* A new module has been added to create readable text against an arbitrary background color based on the lightness of the background: [compass/utilities/color/contrast](/reference/compass/utilities/color/contrast/). +* The comma-delimited-list has been renamed to delimited-list and + generalized to accept a delimiter which defaults to a comma. + The old function continues to exist, but is deprecated. + +### Compass Internals + +* You can now register callbacks for compilation events so that you can take + custom actions when they occur. For instance, you might want to notify + Growl when a stylesheet compilation error occurs. +* Bug fixes & performance improvements. + +0.11.beta.2 (02/01/2011) +------------------------ +* Updated the font-face mixin so it works in Android 2.2. + Credit: [Paul Irish](http://paulirish.com/). +* The deprecated & unused arguments to the font-face mixin have been removed. + +0.11.beta.1 (01/17/2011) +------------------------ +* Add an option `--skip-overrides` to the sprite + subcommand. When provided, the default variables for overriding the sprite + behavior are not created. Instead, you would change the call to + `sprite-map()` to customize your sprite map. +* Rename the `sprite-position` mixin in the new `sprite/base` module to + `sprite-background-position` in order avoid a naming conflict with the old + sprite module. + +0.11.beta.0 (01/09/2011) +------------------------ + +Compass v0.11 is now feature complete. Future changes to this release will be doc improvements, bug fixes, performance tuning, and addressing user feedback. + +* Added optional support for IE8 with $legacy-support-for-ie8 which defaults to true. +* Updated the opacity and filter-gradient mixins to make IE's hacky DirectX filters + optional based on Compass's legacy support settings. +* Added the ability to piggy back on compass's watcher within your configuration file. + See the [configuration reference](/help/tutorials/configuration-reference/) for details. +* The options passed to the CLI can now be inspected within the compass configuration file. + The CLI options will still override the values set within the config file, but they might + inform other values. For instance `compass compile -e production` will have the environment + parameter preset to `:production` so that you can set other values in the project accordingly. +* New infrastructure for supporting experimental css3 functions that are prefixed but have the same + syntax across all browsers. It is now possible to configure which browsers support which + experimental functions outside of the compass release cycle. For details, see the + [cross browser helpers](/reference/compass/helpers/cross-browser/). +* [Blueprint] Added a new sass function called span($n) to the grid module which replaces + the now **deprecated span mixin**. If you are using this mixin, please replace it with: + `width: span($n)`. +* [Blueprint] Blueprint no longer adds `!important` to the widths of `input`, `textarea`, + and `select` form fields, so compass no longer defaults to using `!important` in those cases. + If you were relying on this behavior, you may need to adjust your stylesheets accordingly. + +0.11.alpha.4 (12/08/2010) +------------------------- + +* Add a `--time` option to the compile and watch commands. This will print out + the time spent compiling each sass file and a total at the end. +* Upgrade FSSM, the internal library that monitors the filesystem events for compass. +* Removed the command line options that were deprecated in v0.10. + +0.11.alpha.3 (12/05/2010) +------------------------- + +* Fix a bug in compass running under ruby 1.9.2 that was introduced in v0.11.alpha.2. + +0.11.alpha.2 (12/05/2010) +------------------------- + +* Merge with Lemonade. Compass now provides a full featured spriting solution. + See the [spriting tutorial](/help/tutorials/spriting/) for more information. +* Compass now depends on Sass 3.1. You can install the preview release: + `gem install sass --pre`. Note: you must also upgrade your haml gem if you + use both in the same application. +* A third argument is now available on the `image-url()` helper. When `true` or + `false`, it will enable/disable the cache buster for a single image url. Or when + a string, it will be the cache buster used. +* Upgrade CSS3 PIE to 1.0-beta3. +* Bug fixes. + +0.11.alpha.1 (11/22/2010) +------------------------- + +* Support for Sass 3.1 alpha version +* CSS3 PIE module. [Docs](/reference/compass/css3/pie/). +* The versioned modules in the last release have been removed. There is now + just a single module for each and the overloaded mixins will discern + deprecated usage and warn accordingly. +* Allow erb processing of non all non-binary filetypes during extension installs. +* Added a `background` mixin for css3 gradient support in the shorthand style. +* Fix for gradients in opera with bordered elements. +* The `multiple-text-shadows` and `multiple-box-shadows` mixins that were present in + v0.11.alpha.0 were removed because they were unnecessary. Just use the `text-shadow` + and `box-shadow` mixins. +* The docs are [getting a make-over](http://beta.compass-style.org/) by Brandon :) + +0.11.alpha.0 (11/15/2010) +------------------------- + +Note: Compass does not currently support Sass 3.1 alphas. + +### Deprecations + +* Deprecated imports and APIs from v0.10 have been removed. +* Changed defaults for the box-shadow and text-shadow mixins. + Previously the horizontal and vertical offset were both 1, which + expected a top left light source. They are now set to 0 which assumes + a direct light source, a more generic default. +* The linear-gradient and radial-gradient mixins have been deprecated. + Instead use the background-image mixin and pass it a gradient function. + The deprecation warning will print out the correct call for you to use. +* Passing an argument to the `blueprint-scaffolding` mixin is not necessary + and has been deprecated. +* Some blueprint color defaults now use color functions instead of color arithmetic. + This may result in different output for those who have color customizations. + +### Blueprint + +* Updated from blueprint 0.9 to blueprint 1.0 + * Added .info and .alert classes to forms.css [CMM] + * Fixed numerous bugs in forms, including the fieldset padding bug in IE6-8 [CMM] + * Fixed specificity problems in typography.css and grid.css [CMM] + * See Lighthouse for more bug fixes + * Full [blueprint changelog][blueprint_10_change] + * If for some reason you'd like to stay on the older version of blueprint you can run + the following command in your project before you upgrade (or after temporarily downgrading): + `compass unpack blueprint` + +### CSS3 v2.0 + +Our CSS3 module makes writing CSS3 today almost as easy as it will be when all +the browsers officially support the new features. The second version of the +compass CSS module brings the API up to date with developments over the past +6 to 9 months of browser changes and more closely matching the most recent CSS +specifications. [Upgrade guide](/help/tutorials/upgrading/antares/). Summary of changes. + +* Support for multiple box shadows and text shadows +* Support for 2d and 3d transforms +* Opt-in SVG support for gradients in opera and IE9. + Set `$experimental-support-for-svg : true` in your + stylesheet to enable it. +* Fixed a radial gradient position bug. +* To generate a simple linear gradient in IE6 & 7, you can now use + the `filter-gradient` mixin. +* New `background-image` mixin with gradient support and allowing + up to 10 images. +* Gradient support for the border-image property. +* Gradient support for list-style-image property. +* Gradient support for the content property. + +### Helpers + +* `linear-gradient()` & `radial-gradient()` helpers now intercept standard css + functions and parse them into Sass Literals. These work with new vendor helpers + (`-moz()`, `-webkit`, `-o`, `-ie`, and `-svg` (yes I know svg is not a vendor)) + to return specific representations of the linear & radial gradients. The + `prefixed()` function will check a value to see if it has a certain + vendor-specific representation. +* New color helpers: `adjust-lightness`, `adjust-saturation`, `scale-lightness`, and `scale-saturation` + make it easier to construct apis that manipulate these color attributes. +* The `elements-of-type()` helper now returns html5 elements when the display is `block` + and also will return only html5 elements for `elements-of-type(html5)` +* Compass now provides several helper functions related to trigonometry. + There's no practical use, but it's hoped that users will find fun things to + do with these for technology demonstrations: + * `sin($number)` - Takes the sine of the number. + * `cos($number)` - Takes the cosine of the number. + * `tan($number)` - Takes the tangent of the number. + * `pi()` - Returns the value of π. + If you provide a number with units of `deg` then it will return a unitless number + after converting to radians. Otherwise, it assumes the number is a radian length measure + and passes the units along to the result. +* `ie-hex-str($color)` returns a #AARRGGBB formatted color suitable for + passing to IE filters. +* A new function `if()` that allows you to switch on a value without using `@if`. + Usage: `if($truth-value, $value-if-true, $value-if-false)`. +* Compass has added a number of new helper functions for lists that begin with + `-compass`, helpers that begin with `-compass` should be considered "private" and + are not to be used by compass users. Sass 3.1 will have proper list support, + these are a work around until that time. + +### Configuration + +* Added a new configuration property to disable sass warnings: `disable_warnings` + +### Core Framework + +* New layout mixins for absolute positioning: stretch, stretch-x, stretch-y + +### Rails + +* In rails 3, there's no need for an initializer. Instead we use a + Railstie. +* We now default to app/stylesheets for sass files and public/stylesheets for + css files -- though they can still be changed after installation or on the + command line during project initialization. +* Compass is now a gem plugin in a rails environment. +* In a rails3 environment the compass configuration can now be + changed without restarting the rails server process. \ No newline at end of file diff --git a/doc-src/content/CHANGELOG.markdown b/doc-src/content/CHANGELOG.markdown index 19f04ecb..65d879db 100644 --- a/doc-src/content/CHANGELOG.markdown +++ b/doc-src/content/CHANGELOG.markdown @@ -7,88 +7,26 @@ layout: default COMPASS CHANGELOG ================= -Upgrading compass is really easy. +Upgrading compass is pretty easy. Don't let all these details [scare you...](/help/tutorials/upgrading/im-scared/) The Documentation for the [latest stable release](http://compass-style.org/docs/): The Documentation for the [latest preview release](http://beta.compass-style.org/) -0.11.alpha.5 (future) ---------------------- +0.11.0 (04/24/2011) +------------------- -* Added optional support for IE8 with $legacy-support-for-ie8 which defaults to true. -* Updated the opacity and filter-gradient mixins to make IE's hacky DirectX filters - optional based on Compass's legacy support settings. -* Added the ability to piggy back on compass's watcher within your configuration file. - See the [configuration reference](/help/tutorials/configuration-reference/) for details. -* The options passed to the CLI can now be inspected within the compass configuration file. - The CLI options will still override the values set within the config file, but they might - inform other values. For instance `compass compile -e production` will have the environment - parameter preset to `:production` so that you can set other values in the project accordingly. -* New infrastructure for supporting experimental css3 functions that are prefixed but have the same - syntax across all browsers. It is now possible to configure which browsers support which - experimental functions outside of the compass release cycle. For details, see the - [cross browser helpers](/reference/compass/helpers/cross-browser/). -* [Blueprint] Added a new sass function called span($n) to the grid module which replaces - the now **deprecated span mixin**. If you are using this mixin, please replace it with: - `width: span($n)`. -* [Blueprint] Blueprint no longer adds `!important` to the widths of `input`, `textarea`, - and `select` form fields, so compass no longer defaults to using `!important` in those cases. - If you were relying on this behavior, you may need to adjust your stylesheets accordingly. +This changelog entry is aggregated across all the v0.11 beta releases. +If you're upgrading from a previous beta v0.11 beta release, you can read +[the 0.11 beta release notes here](/CHANGELOG-v0-11-beta/). +### !important -0.11.alpha.4 (12/08/2010) -------------------------- +#### Breaking Changes & Deprecations: -* Add a `--time` option to the compile and watch commands. This will print out - the time spent compiling each sass file and a total at the end. -* Upgrade FSSM, the internal library that monitors the filesystem events for compass. -* Removed the command line options that were deprecated in v0.10. - -0.11.alpha.3 (12/05/2010) -------------------------- - -* Fix a bug in compass running under ruby 1.9.2 that was introduced in v0.11.alpha.2. - -0.11.alpha.2 (12/05/2010) -------------------------- - -* Merge with Lemonade. Compass now provides a full featured spriting solution. - See the [spriting tutorial](/help/tutorials/spriting/) for more information. -* Compass now depends on Sass 3.1. You can install the preview release: - `gem install sass --pre`. Note: you must also upgrade your haml gem if you - use both in the same application. -* A third argument is now available on the `image-url()` helper. When `true` or - `false`, it will enable/disable the cache buster for a single image url. Or when - a string, it will be the cache buster used. -* Upgrade CSS3 PIE to 1.0-beta3. -* Bug fixes. - -0.11.alpha.1 (11/22/2010) -------------------------- - -* Support for Sass 3.1 alpha version -* CSS3 PIE module. [Docs](/reference/compass/css3/pie/). -* The versioned modules in the last release have been removed. There is now - just a single module for each and the overloaded mixins will discern - deprecated usage and warn accordingly. -* Allow erb processing of non all non-binary filetypes during extension installs. -* Added a `background` mixin for css3 gradient support in the shorthand style. -* Fix for gradients in opera with bordered elements. -* The `multiple-text-shadows` and `multiple-box-shadows` mixins that were present in - v0.11.alpha.0 were removed because they were unnecessary. Just use the `text-shadow` - and `box-shadow` mixins. -* The docs are [getting a make-over](http://beta.compass-style.org/) by Brandon :) - -0.11.alpha.0 (11/15/2010) -------------------------- - -Note: Compass does not currently support Sass 3.1 alphas. - -### Deprecations - -* Deprecated imports and APIs from v0.10 have been removed. +* Deprecated imports and APIs from v0.10 have been removed. If you are upgrading + from v0.8, please upgrade to v0.10 before installing v0.11. * Changed defaults for the box-shadow and text-shadow mixins. Previously the horizontal and vertical offset were both 1, which expected a top left light source. They are now set to 0 which assumes @@ -100,6 +38,31 @@ Note: Compass does not currently support Sass 3.1 alphas. and has been deprecated. * Some blueprint color defaults now use color functions instead of color arithmetic. This may result in different output for those who have color customizations. +* The deprecated & unused arguments to the `font-face` mixin have been removed. +* Lemonade has been merged into compass. If you've been using Lemonade, you need to + upgrade your sprites to use the new [Compass Sprites](/help/tutorials/spriting/). + +#### Dependencies + +* Compass now depends on Sass 3.1 which is a new stand-alone gem that has been separated + from Haml. **If you have Haml installed, you must upgrade it to 3.1 as well.** +* Compass now depends on ChunkyPNG, a pure-ruby library for generating PNG files. +* The FSSM library that used to be vendored is now upgraded and a normal gem dependency. + If you don't know what this means, then you don't need to care :) + +### New Sass Features + +Sass 3.1 brings a ton of great new features that Compass now uses and you can too! + +* Proper List Support. Space and Comma separated lists used to cause values to become strings when passing them to mixins. Now the values in lists are preserved as their original types. +* Sass-based Functions. Define your own value functions and use them anywhere. +* Keyword Style Argument passing to Functions and Mixins. It can be hard to understand what + the values being passed to a mixin or function are for, use keyword style arguments to + make it easier to understand what's going on. +* `@media` bubbling. Use a media declaration anywhere and it will be bubbled to the top level + for you. + +For more information about the new Sass features, see the [Sass CHANGELOG](http://sass-lang.com/docs/yardoc/file.SASS_CHANGELOG.html). ### Blueprint @@ -112,8 +75,26 @@ Note: Compass does not currently support Sass 3.1 alphas. * If for some reason you'd like to stay on the older version of blueprint you can run the following command in your project before you upgrade (or after temporarily downgrading): `compass unpack blueprint` +* [Blueprint] Blueprint no longer adds `!important` to the widths of `input`, `textarea`, + and `select` form fields, so compass no longer defaults to using `!important` in those cases. + If you were relying on this behavior, you may need to adjust your stylesheets accordingly. +* [Blueprint] Added a new sass function called span($n) to the grid module which replaces + the now **deprecated span mixin**. If you are using this mixin, please replace it with: + `width: span($n)`. -### CSS3 v2.0 +### Spriting Support + +* Compass now has a world-class spriting system after merging with [Lemonade][lemonade]. + See the [spriting tutorial](/help/tutorials/spriting/) for more information. +* The [old sprite module](/reference/compass/utilities/sprites/sprite_img/) is still available + for working with hand-generated sprite maps. +* The Sprite internals are abstracted allowing for different engines. By default + compass uses ChunkyPNG which only supports PNG files, so some users might prefer + ImageMagic which is available via a [plugin](#XXXLINKME). +* [Magic Selectors](/help/tutorials/spriting/#magic-selectors) make it simple to define + sprites that work with user interaction pseudo classes like `:hover`, `:active`, etc. + +### CSS3 Module v2.0 Our CSS3 module makes writing CSS3 today almost as easy as it will be when all the browsers officially support the new features. The second version of the @@ -121,30 +102,39 @@ compass CSS module brings the API up to date with developments over the past 6 to 9 months of browser changes and more closely matching the most recent CSS specifications. [Upgrade guide](/help/tutorials/upgrading/antares/). Summary of changes. -* Support for multiple box shadows and text shadows -* Support for 2d and 3d transforms -* Opt-in SVG support for gradients in opera and IE9. - Set `$experimental-support-for-svg : true` in your +* Support for multiple [box shadows](/reference/compass/css3/box_shadow/) + and multiple [text shadows](/reference/compass/css3/text-shadow/) +* Support for [2d and 3d transforms](/reference/compass/css3/transform/) +* Opt-in [SVG support](/reference/compass/support/#const-experimental-support-for-svg) + for gradients in opera and IE9. Set `$experimental-support-for-svg : true` in your stylesheet to enable it. -* Fixed a radial gradient position bug. * To generate a simple linear gradient in IE6 & 7, you can now use - the `filter-gradient` mixin. -* New `background-image` mixin with gradient support and allowing - up to 10 images. -* Gradient support for the border-image property. -* Gradient support for list-style-image property. -* Gradient support for the content property. + the [filter-gradient mixin](/reference/compass/css3/images/#mixin-filter-gradient). +* New [images module](/reference/compass/css3/images/) makes gradients simple for + all properties that support them using the CSS3 standard syntax. +* Compass now has opt-in support for the CSS3 PIE library. [Docs](/reference/compass/css3/pie/). +* Added optional support for IE8 with `$legacy-support-for-ie8` which defaults to true. +* Updated the `opacity` and `filter-gradient` mixins to make IE's hacky DirectX filters + optional based on Compass's legacy support settings. +* A new CSS3 mixin for [appearance](/reference/compass/css3/appearance/) was added. +* The font-face mixin has been updated again with the [syntax recommendations + from font-spring](http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax). + The API has not changed. +* Added support for the new webkit gradient syntax that matches the css3 specification. + Support for older webkit browsers remains enabled at this time. + To disable it, set `$support-for-original-webkit-gradients` to false. -### Helpers +### Helper Functions * `linear-gradient()` & `radial-gradient()` helpers now intercept standard css functions and parse them into Sass Literals. These work with new vendor helpers - (`-moz()`, `-webkit`, `-o`, `-ie`, and `-svg` (yes I know svg is not a vendor)) + (`-moz()`, `-webkit`, `-o`, `-ie`, and `-svg` (yes, we know svg is not a vendor)) to return specific representations of the linear & radial gradients. The `prefixed()` function will check a value to see if it has a certain vendor-specific representation. -* New color helpers: `adjust-lightness`, `adjust-saturation`, `scale-lightness`, and `scale-saturation` - make it easier to construct apis that manipulate these color attributes. +* New color helpers: `adjust-lightness`, `adjust-saturation`, `scale-lightness`, + and `scale-saturation` make it easier to construct apis that manipulate these + color attributes. * The `elements-of-type()` helper now returns html5 elements when the display is `block` and also will return only html5 elements for `elements-of-type(html5)` * Compass now provides several helper functions related to trigonometry. @@ -155,29 +145,68 @@ specifications. [Upgrade guide](/help/tutorials/upgrading/antares/). Summary of * `tan($number)` - Takes the tangent of the number. * `pi()` - Returns the value of π. If you provide a number with units of `deg` then it will return a unitless number - after converting to radians. Otherwise, it assumes the number is a radian length measure - and passes the units along to the result. + after converting to radians. Otherwise, it assumes the number is a radian length + measure and passes the units along to the result. * `ie-hex-str($color)` returns a #AARRGGBB formatted color suitable for passing to IE filters. -* A new function `if()` that allows you to switch on a value without using `@if`. - Usage: `if($truth-value, $value-if-true, $value-if-false)`. -* Compass has added a number of new helper functions for lists that begin with - `-compass`, helpers that begin with `-compass` should be considered "private" and - are not to be used by compass users. Sass 3.1 will have proper list support, - these are a work around until that time. +* Compass has added a number of new helper functions that begin with + `-compass`, helpers that begin with `-compass` should be considered "private" + and are not to be used. +* A third argument is now available on the `image-url()` helper. When `true` or + `false`, it will enable/disable the cache buster for a single image url. Or when + a string, will be the cache buster value that is used. -### Configuration +### Configuration Files * Added a new configuration property to disable sass warnings: `disable_warnings` +* New infrastructure for supporting experimental css3 functions that are prefixed but have + the same syntax across all browsers. It is now possible to configure which browsers + support which experimental functions outside of the compass release cycle. + For details, see the [cross browser helpers](/reference/compass/helpers/cross-browser/). +* The options passed to the CLI can now be inspected within the compass configuration file. + The CLI options will still override the values set within the config file, but they might + inform other values. For instance `compass compile -e production` will have the environment + parameter preset to `:production` so that you can set other values in the project accordingly. +* Added the ability to piggy back on compass's watcher within your configuration file. + See the [configuration reference](/help/tutorials/configuration-reference/) for details. +* You can now register callbacks for compilation events so that you can take + custom actions when they occur. For instance, you might want to notify + Growl when a stylesheet compilation error occurs. -### Core Framework +### New Compass Typography Module + +* Some text-based mixins have been moved from utilities to the new + typography module. The old imports are deprecated now. + Affected modules: `utilities/links`, `utilities/lists`, and `utilities/text` and + their sub-modules. +* There is a new typography module: + [Vertical Rhythm](/reference/compass/typography/vertical_rhythm/). + This makes it easier to align the typography of your page to a common rhythm. + +### Compass Layout Module * New layout mixins for absolute positioning: stretch, stretch-x, stretch-y +* There is a new mixin for creating + [pure-css grid backgrounds](/reference/compass/layout/grid_background/) + for verifying grid alignment for both fixed and fluid grids. + +### Compass Utilities + +* A new mixin `reset-float` is available in the [float module](/reference/compass/utilities/general/float/#mixin-reset-float) that makes it easier to reset the floats introduced from that module. +* A new module has been added to create readable text against an arbitrary background color based on the lightness of the background: [compass/utilities/color/contrast](/reference/compass/utilities/color/contrast/). +* The comma-delimited-list has been renamed to delimited-list and + generalized to accept a delimiter which defaults to a comma. + The old function continues to exist, but is deprecated. + +### Command Line + +* Add a `--time` option to the compile and watch commands. This will print out + the time spent compiling each sass file and a total at the end. ### Rails * In rails 3, there's no need for an initializer. Instead we use a - Railstie. + Railtie. If you have one, please remove it. * We now default to app/stylesheets for sass files and public/stylesheets for css files -- though they can still be changed after installation or on the command line during project initialization. @@ -185,6 +214,20 @@ specifications. [Upgrade guide](/help/tutorials/upgrading/antares/). Summary of * In a rails3 environment the compass configuration can now be changed without restarting the rails server process. +### Extensions + +* Compass now allows ERB processing of non all non-binary filetypes during + extension installs. +* Extensions that are installed into `~/.compass/extensions` will be automatically + available to all your compass projects. +* Created an official API to add configuration options to compass. + [More information](/help/tutorials/extending/). + +### Miscellaneous + +* We have a new website design from [Brandon Mathis][brandon] +* Compass now officially supports the following ruby interpreters: + jruby, ruby 1.8.7, ruby 1.9.2, ree, and rubinius. 0.10.7 (UNRELEASED) ------------------- @@ -1046,6 +1089,8 @@ Almost definitely. Please let me know if you encounter any problems and I'll get [der-rich]: http://github.com/der-rich [adamstac]: http://github.com/adamstac [ttilley]: http://github.com/ttilley -[inline-block-list]: http://compass-style.org/reference/compass/utilities/lists/inline-block-list/ +[inline-block-list]: http://compass-style.org/reference/compass/typography/lists/inline-block-list/ [html5-reset]: http://compass-style.org/reference/compass/reset/utilities/#mixin-reset-html5 [blueprint_10_change]: https://github.com/chriseppstein/compass/compare/a05e1ee7c0a1e4c0f0595a8bb812daa47872e476...864780969d872a93b1fd3b4f39f29dd9f0c3fe75 +[brandon]: http://brandonmathis.com/ +[lemonade]: http://www.hagenburger.net/BLOG/Lemonade-CSS-Sprites-for-Sass-Compass.html \ No newline at end of file diff --git a/doc-src/content/blog.haml b/doc-src/content/blog.haml new file mode 100644 index 00000000..e53a96c5 --- /dev/null +++ b/doc-src/content/blog.haml @@ -0,0 +1,14 @@ +--- +layout: blog +--- +%h1 Compass Blog + +- for post in blog_posts_in_order.reverse + .post-snippet + %h2 + - time = blog_date(post) + %span.timestamp= time.strftime("%Y/%m/%d") + %a{:href => post.rep_named(:default).path}= post[:title] + %p= post[:intro] || post[:description] + + diff --git a/doc-src/content/blog/archive.haml b/doc-src/content/blog/archive.haml new file mode 100644 index 00000000..67faea8f --- /dev/null +++ b/doc-src/content/blog/archive.haml @@ -0,0 +1,14 @@ +--- +layout: blog +--- +%h1 Compass Blog Archive + +- for post in blog_posts_in_order.reverse + .post-snippet + %h2 + - time = blog_date(post) + %span.timestamp= time.strftime("%Y/%m/%d") + %a{:href => post.rep_named(:default).path}= post[:title] + %p= post[:intro] || post[:description] + + diff --git a/doc-src/content/blog/atom.haml b/doc-src/content/blog/atom.haml new file mode 100644 index 00000000..b328482b --- /dev/null +++ b/doc-src/content/blog/atom.haml @@ -0,0 +1,19 @@ + +%feed(xmlns="http://www.w3.org/2005/Atom") + %title Compass Blog + %link(href="http://compass-style.org/blog/atom.xml" rel="self") + %link(href="http://compass-style.org/blog/") + %updated= Time.now.xmlschema + %id http://compass-style.org/blog/ + %author + %name Compass Core Team + - for post in blog_posts_in_order.reverse + - full_url = "http://compass-style.org#{post.rep_named(:default).path}" + %entry + %title&= post[:title] + %link{:href=> full_url} + %updated= blog_date(post).localtime.xmlschema + %id= full_url[0..-2] + %content(type="html") + = post[:intro] || post[:description] + diff --git a/doc-src/content/examples/compass/css3/gradient/stylesheet.sass b/doc-src/content/examples/compass/css3/gradient/stylesheet.sass index d5edcdbb..509e4584 100644 --- a/doc-src/content/examples/compass/css3/gradient/stylesheet.sass +++ b/doc-src/content/examples/compass/css3/gradient/stylesheet.sass @@ -14,7 +14,7 @@ // This will yield a radial gradient with an apparent specular highlight #radial-gradient - +background-image(radial-gradient(45 45, #0ff 10px, #1e90ff 30px)) + +background-image(radial-gradient(45px 45px, #0ff 10px, #1e90ff 30px)) // This yields a linear gradient spanning from the upper left corner to the lower right corner #linear-gradient diff --git a/doc-src/content/examples/compass/layout/stretching/markup.haml b/doc-src/content/examples/compass/layout/stretching/markup.haml index 24a9dbba..2bb89b98 100644 --- a/doc-src/content/examples/compass/layout/stretching/markup.haml +++ b/doc-src/content/examples/compass/layout/stretching/markup.haml @@ -1,17 +1,30 @@ .example - Click on the the following links to make them stretch. - Click here to dismiss it. - #stretch-container - %ul - %li - %a#stretch-full(href="#stretch-full") - This element is fully stretched. - %li - %a#stretch-offset(href="#stretch-offset") - This element is stretched with a 1em offset on each side. - %li - %a#stretch-x(href="#stretch-x") - This element is stretched horizontally. - %li - %a#stretch-y(href="#stretch-y") - This element is stretched vertically. + %ul + %li.stretch-container + #stretch-full + This element is fully stretched. + %li.stretch-container + #stretch-offset + This element is stretched with a 1em offset on each side. + %li.stretch-container + #stretch-x + This + %br + element + %br + is + %br + stretched + %br + horizontally. + %li.stretch-container + #stretch-y + This + %br + element + %br + is + %br + stretched + %br + vertically. diff --git a/doc-src/content/examples/compass/layout/stretching/stylesheet.sass b/doc-src/content/examples/compass/layout/stretching/stylesheet.sass index b3ba1412..63894268 100644 --- a/doc-src/content/examples/compass/layout/stretching/stylesheet.sass +++ b/doc-src/content/examples/compass/layout/stretching/stylesheet.sass @@ -1,29 +1,32 @@ @import "compass/layout/stretching" +@import "compass/utilities" @import "compass/css3" -#stretch-container +.stretch-container border: 1px solid #999 - min-width: 200px - min-height: 200px + width: 200px + height: 200px position: relative + +inline-block .stretched $stretch-color: #4C6B99 border: 3px solid $stretch-color +border-radius(8px) display: block background-color: darken($stretch-color, 30%) + color: white text-align: center vertical-align: middle - padding: 2em 0 -#stretch-full:target + padding: 0.5em +#stretch-full @extend .stretched +stretch -#stretch-offset:target +#stretch-offset @extend .stretched +stretch(1em, 1em, 1em, 1em) -#stretch-x:target +#stretch-x @extend .stretched +stretch-x -#stretch-y:target +#stretch-y @extend .stretched +stretch-y diff --git a/doc-src/content/examples/compass/utilities/contrast.haml b/doc-src/content/examples/compass/utilities/contrast.haml new file mode 100644 index 00000000..eca3504a --- /dev/null +++ b/doc-src/content/examples/compass/utilities/contrast.haml @@ -0,0 +1,8 @@ +--- +title: Compass Contrast Color Example +description: Make text readable +framework: compass +stylesheet: compass/utilities/color/_contrast.scss +example: true +--- += render "partials/example" diff --git a/doc-src/content/examples/compass/utilities/contrast/markup.haml b/doc-src/content/examples/compass/utilities/contrast/markup.haml new file mode 100644 index 00000000..c5184b33 --- /dev/null +++ b/doc-src/content/examples/compass/utilities/contrast/markup.haml @@ -0,0 +1,3 @@ +.example + %p.dark This is a paragraph with a dark background and light text. + %p.light This is a paragraph with a light background and dark text. diff --git a/doc-src/content/examples/compass/utilities/contrast/stylesheet.sass b/doc-src/content/examples/compass/utilities/contrast/stylesheet.sass new file mode 100644 index 00000000..2e8c9416 --- /dev/null +++ b/doc-src/content/examples/compass/utilities/contrast/stylesheet.sass @@ -0,0 +1,11 @@ +$contrasted-dark-default: #333 +$contrasted-light-default: #e7e7e7 + +@import "compass/utilities/color/contrast" + +.example + p.dark + +contrasted(#5F1210) + p.light + +contrasted(#C82523) + diff --git a/doc-src/content/help/tutorials.haml b/doc-src/content/help/tutorials.haml index dbeb2ee5..047f8f52 100644 --- a/doc-src/content/help/tutorials.haml +++ b/doc-src/content/help/tutorials.haml @@ -13,9 +13,9 @@ layout: tutorial ## New to Compass? - If you're new to Compass, you might be interested in [best practices](/help/tutorials/best-practices), the [configuration reference](/help/tutorials/configuration-reference), [configurable variables](/help/tutorials/configurable-variables), - or the [command line documentation](/help/tutorials/command-line). + If you're new to Compass, you might be interested in [best practices](/help/tutorials/best_practices/), the [configuration reference](/help/tutorials/configuration-reference/), [configurable variables](/help/tutorials/configurable-variables/), + or the [command line documentation](/help/tutorials/command-line/). ## Want to contribute? - If you've been using Compass for a while and you'd like to give back, check out the tutorials on [contributing](/help/tutorials/contributing) and [creating extensions](/help/tutorials/extensions). + If you've been using Compass for a while and you'd like to give back, check out the tutorials on [contributing](/help/tutorials/contributing/) and [creating extensions](/help/tutorials/extensions/). diff --git a/doc-src/content/help/tutorials/configuration-reference.markdown b/doc-src/content/help/tutorials/configuration-reference.markdown index 8bf0d11b..af6d6ea7 100644 --- a/doc-src/content/help/tutorials/configuration-reference.markdown +++ b/doc-src/content/help/tutorials/configuration-reference.markdown @@ -9,7 +9,7 @@ classnames: The compass configuration file is a ruby file, which means that we can do some clever things if we want to. But don’t let it frighten you; it’s really quite easy to set up your project. - + ## Basic format Most configuration properties are a simple assignment to a configuration property. @@ -35,11 +35,12 @@ There are two kinds of composite values: It is a comma delimited list of associations surrounded by curly brackets. An association is two values separated by `=>`. E.g. `{:foo => "aaa", :bar => "zzz"}` + ## Comments Use the hash sign `#` to comment out everything from the hash sign to the end of the line. - + ## Import Note for Windows Users The backslash character (`\`) is a special character in a string delimited by @@ -47,6 +48,7 @@ double quotes (`"`). If you are working with folders in your paths, you should either use **single quotes** to delimit your strings or escape your backslash by doubling it like `"some\\path"`. + ## Loading Compass Plugins Compass relies on the ruby `require` mechanism to load other libraries of code. @@ -59,11 +61,13 @@ Example: require 'ninesixty' require 'susy' + ## Overriding Configuration Settings When using the compass command line, configuration options that you set on the command line will override the corresponding settings in your configuration file. + ## Inspecting Configuration Settings passed via the Command Line When using the compass command line, configuration options that you set on the @@ -78,7 +82,7 @@ Then you can inspect the value like so: Values that are not set on the CLI will be `nil` even though they will have a default value later on. - + ## Configuration Properties @@ -217,13 +221,13 @@ later on. approach. - - - + + + - + + @@ -271,8 +275,14 @@ later on. + + + + +
disable_warnings Boolean
disable_warnings Boolean Set this to true to silence deprecation warnings. -
sass_options Hash String The relative http path to font files on the web server.
sprite_engine Symbol Defaults to :chunky_png
+ ## Configuration Functions **`add_import_path`** – Call this function to add a path to the list of sass import @@ -330,4 +340,37 @@ more than once. Example: end This code will be called if the file is added, updated, or removed. Be sure to check for existence -to avoid crashing the watcher in the case where the file has been removed. \ No newline at end of file +to avoid crashing the watcher in the case where the file has been removed. + +## Callbacks + +**`on_sprite_saved`** -- Pass this function a block of code that gets executed after a sprite is saved to disk. The block will be passed the filename. Can be invoked more then once. Example: + + on_sprite_saved do |filename| + post_process(filename) if File.exists?(filename) + end + +**`on_sprite_generated`** -- Pass this function a block of code that gets executed after a sprite is generated but before its saved to disk. The block will be passed an instance of `ChunkyPNG::Image`. Can be invoked more then once. Example: + + on_sprite_generated do |sprite_data| + sprite_data.metadata['Caption'] = "This Image is © My Company 2011" + end + +**`on_stylesheet_saved`** -- Pass this function a block of code that gets executed after a stylesheet is processed. The block will be passed the filename. Can be invoked more then once. Example: + + on_stylesheet_saved do |filename| + Growl.notify { + self.message "#{File.basename(filename)} updated!" + self.icon = '/path/to/success.jpg' + } + end + +**`on_stylesheet_error`** -- Pass this function a block of code that gets executed if a stylesheet has an error while processing. The block will be passed the filename and the error message. Can be invoked more then once. Example: + + on_stylesheet_error do |filename, message| + Growl.notify { + self.message = "#{File.basename(filename)}: #{message}" + self.icon = '/path/to/fail.jpg' + sticky! + } + end \ No newline at end of file diff --git a/doc-src/content/help/tutorials/extending.markdown b/doc-src/content/help/tutorials/extending.markdown new file mode 100644 index 00000000..9d7f4d88 --- /dev/null +++ b/doc-src/content/help/tutorials/extending.markdown @@ -0,0 +1,73 @@ +--- +title: Extending Compass +layout: tutorial +crumb: Extending Compass +classnames: + - tutorial +--- + +# Extending Compass + +## Sprite engine + +The sprite engine is the work horse of sprite generation it's the interface for assembling and writing the image file to disk. + +### Requirements + +A sprite engine requires only one method and that is `construct_sprite` which must return an object that responds to `save(filepath)` + +Once inside this method you have access to `images` which is a collection of [Compass::SassExtensions::Sprites::Image](http://rdoc.info/github/chriseppstein/compass/dda7c9/Compass/SassExtensions/Sprites/Image) + +Since the Engine module extends base you also have access to all methods in [Compass::SassExtensions::Sprites::Base](http://rdoc.info/github/chriseppstein/compass/dda7c9/Compass/SassExtensions/Sprites/Base) + +### Configuration + +To enable your sprite engine from the config file set + + sprite_engine = : + +The example below will load `Compass::SassExtension::Sprites::ChunkyPngEngine` + + sprite_engine = :chunky_png + +### Class Definition + + module Compass + module SassExtensions + module Sprites + module Engine + + # Returns an object + def construct_sprite + #must return a image object that responds to save(filename) + end + + end + end + end + end + + +## Adding Configuration Properties to Compass + +To add a new configuration property to Compass: + + Compass::Configuration.add_configuration_property(:foobar, "this is a foobar") do + if environment == :production + "foo" + else + "bar" + end + end + +This will do several things: + +1. make it possible for users to set the `foobar` configuration property in their + configuration file. +2. Ruby code can read and write the `foobar` attribute from any configuration object. +3. It will add the comment `# this is a foobar` above the property in the configuration file. + A comment is not required, you can simply omit this argument if you like. +4. The block of code provided allows you to assign a sensible default value according to other + settings in the configuration or by using arbitrary code to determine what the value should + be. For instance it could read from another configuration file or it could change based on + the user's operating system. \ No newline at end of file diff --git a/doc-src/content/help/tutorials/extensions.markdown b/doc-src/content/help/tutorials/extensions.markdown index a364d870..791a3ed4 100644 --- a/doc-src/content/help/tutorials/extensions.markdown +++ b/doc-src/content/help/tutorials/extensions.markdown @@ -71,6 +71,10 @@ you can use compass to generate an extension with the following command: This will create a few basic files and folders to get you started. +If you prefer to use the scss syntax for your extension run the following command instead: + + compass create my_extension --using compass/extension -x scss + Advanced Layout Options ----------------------- @@ -106,6 +110,10 @@ template directories are not at the top level, you can just do this instead: base_directory = File.join(File.dirname(__FILE__), '..', 'compass') Compass::Frameworks.register('my_extension', :path => base_directory) +### Adding Configuration Options to Compass + +For details on how to add new configuration options to compass [read this](/help/tutorials/extending/#adding-configuration-properties). + Conventions to Follow --------------------- diff --git a/doc-src/content/help/tutorials/integration.markdown b/doc-src/content/help/tutorials/integration.markdown new file mode 100644 index 00000000..daac952b --- /dev/null +++ b/doc-src/content/help/tutorials/integration.markdown @@ -0,0 +1,83 @@ +--- +title: Application Integration +layout: tutorial +crumb: Appliction Integration +classnames: + - tutorial +--- +# Application Integration + +## Ruby on Rails + +### Rails 3 + compass init rails /path/to/myrailsproject +### Rails 2.3 + rake rails:template LOCATION=http://compass-style.org/rails/installer + +## Sinatra + + require 'sinatra' + require 'haml' + require 'sass' + require 'compass' + + configure do + Compass.configuration do |config| + config.project_path = File.dirname(__FILE__) + config.sass_dir = 'views' + end + + set :haml, { :format => :html5 } + set :sass, Compass.sass_engine_options + end + + get '/screen.css' do + content_type 'text/css', :charset => 'utf-8' + sass :screen + end + +If you keep your stylesheets in “views/stylesheets/” directory instead of just “views/”, remember to update sass_dir configuration accordingly. +Check out this [sample compass-sinatra project](http://github.com/chriseppstein/compass-sinatra) to get up and running in no time! + +[Sinatra Bootstrap](http://github.com/adamstac/sinatra-bootstrap) - a base Sinatra project with support for Haml, Sass, Compass, jQuery and more. + +## Nanoc3 + +### Minimal integration: just drop it in + +One simple route for lightweight integration is to simply install compass inside nanoc. Then edit config.rb to point to the stylesheets you want to use. This means you have to have the Compass watch command running in a separate window from the Nanoc compilation process. + +Example project that works this way: http://github.com/unthinkingly/unthinkingly-blog + +### More formal integration + +At the top of the Nanoc Rules file, load the Compass configuration, like this: + + require 'compass' + + Compass.add_project_configuration 'compass/config.rb' # when using Compass 0.10 + Compass.configuration.parse 'compass/config.rb' # when using Compass < 0.10 + +Your Compass configuration file (in compass/config.rb) could look like this (you may need to change the path to some directories depending on your directory structure): + + http_path = "/" + project_path = "." + css_dir = "output/assets/style" + sass_dir = "content/assets/style" + images_dir = "output/assets/images" + + # when using SCSS: + sass_options = { + :syntax => :scss + } + + +To filter the stylesheets using Sass and Compass, call the sass filter with Sass engine options taken from Compass, like this: + + filter :sass, Compass.sass_engine_options + + +### Nanoc Projects using the formal approach + +* [nanoc Bootstrap](http://github.com/adamstac/nanoc-bootstrap) - a base nanoc project with support for Haml, Sass, Compass, jQuery and more. +* [nanoc & Compass Example Project](http://github.com/ddfreyne/nanoc-bootstrap-compass) \ No newline at end of file diff --git a/doc-src/content/help/tutorials/spriting.markdown b/doc-src/content/help/tutorials/spriting.markdown index 40f0e6a4..77169578 100644 --- a/doc-src/content/help/tutorials/spriting.markdown +++ b/doc-src/content/help/tutorials/spriting.markdown @@ -7,7 +7,7 @@ classnames: --- # Spriting with Compass -Spriting has never been easier with Compass. You place the sprite images to be in a folder, +Spriting has never been easier with Compass. You place the sprite images in a folder, import them into your stylesheet, and then you can use the sprite in your selectors in one of several convenient ways. @@ -24,7 +24,7 @@ Each is an icon that is 32px square. ## Basic Usage The simplest way to use these icon sprites is to let compass give you a class for each sprite: - + @import "icon/*.png"; @include all-icon-sprites; @@ -52,6 +52,7 @@ simple naming convention for your sprites so that you they are easy to remember should never have to care what the is name of the generated sprite map, nor where a sprite is located within it. + ## Selector Control If you want control over what selectors are generated, it is easy to do. In this example, @@ -100,6 +101,64 @@ might want to avoid it. For instance, if your sprite map has more than about 20 sprites, you may find that hand crafting the import will speed up compilation times. See the section on [performance considerations](#performance) for more details. + +## Magic Selectors + +If you want to add selectors for your sprites, it's easy todo by adding `_active` `_target` or `_hover` to the file name, In the example below we have a sprite directory that looks like: + +* `selectors/ten-by-ten.png` +* `selectors/ten-by-ten_hover.png` +* `selectors/ten-by-ten_active.png` +* `selectors/ten-by-ten_target.png` + +Now in our sass file we add: + + @import "selectors/*.png"; + + a { + @include selectors-sprite(ten-by-ten) + } + +And your stylesheet will compile to: + + .selectors-sprite, a { + background: url('/selectors-edfef809e2.png') no-repeat; + } + + a { + background-position: 0 0; + } + a:hover, a.ten-by-ten_hover, a.ten-by-ten-hover { + background-position: 0 -20px; + } + a:target, a.ten-by-ten_target, a.ten-by-ten-target { + background-position: 0 -30px; + } + a:active, a.ten-by-ten_active, a.ten-by-ten-active { + background-position: 0 -10px; + } + +Alternatively you can use the `@include all-selectors-sprites;` after the import and get the following output: + + .selectors-sprite, .selectors-ten-by-ten { + background: url('/selectors-edfef809e2.png') no-repeat; + } + + .selectors-ten-by-ten { + background-position: 0 0; + } + .selectors-ten-by-ten:hover, .selectors-ten-by-ten.ten-by-ten_hover, .selectors-ten-by-ten.ten-by-ten-hover { + background-position: 0 -20px; + } + .selectors-ten-by-ten:target, .selectors-ten-by-ten.ten-by-ten_target, .selectors-ten-by-ten.ten-by-ten-target { + background-position: 0 -30px; + } + .selectors-ten-by-ten:active, .selectors-ten-by-ten.ten-by-ten_active, .selectors-ten-by-ten.ten-by-ten-active { + background-position: 0 -10px; + } + + + ## Customization Options diff --git a/doc-src/content/help/tutorials/upgrading/antares.markdown b/doc-src/content/help/tutorials/upgrading/antares.markdown index 08ab46c1..6d9deb7a 100644 --- a/doc-src/content/help/tutorials/upgrading/antares.markdown +++ b/doc-src/content/help/tutorials/upgrading/antares.markdown @@ -76,6 +76,22 @@ Or for sass files: =linear-gradient($color-stops, $start: top, $image: false) +background-image($image, linear-gradient($start, $color-stops)) + +## Typography Module + +With the addition of vertical-rhythms to the compass core, we have created a new +[typography module][typography_module], and moved several items that were formerly +listed as "utilities" into it. The moved modules are "links", "lists" and "text". +These will all remain part of the basic compass include, but if you were including +them individually in your stylesheets, you will need to adjust the include paths +as follows: + +* "compass/utilities/links" becomes "compass/typography/links" +* "compass/utilities/lists" becomes "compass/typography/lists" +* "compass/utilities/text" becomes "compass/typography/text" + + [new_transform]: /reference/compass/css3/transform/ [old_transform]: /reference/compass/css3/transform-legacy/ -[image_stylesheet]: /reference/compass/css3/images/ \ No newline at end of file +[image_stylesheet]: /reference/compass/css3/images/ +[typography_module]: /reference/compass/typography/ \ No newline at end of file diff --git a/doc-src/content/help/tutorials/upgrading/lemonade_upgrade_guide.markdown b/doc-src/content/help/tutorials/upgrading/lemonade_upgrade_guide.markdown new file mode 100644 index 00000000..d845ba7e --- /dev/null +++ b/doc-src/content/help/tutorials/upgrading/lemonade_upgrade_guide.markdown @@ -0,0 +1,50 @@ +--- +title: Lemonade Upgrade Guide +layout: tutorial +crumb: Lemonade Upgrade +classnames: + - tutorial +--- +# Lemonade Upgrade Guide +## Example 1 + +### Lemonade + + .logo { + background: sprite-image("lemonade/lemonade-logo.png"); + } + .lime { + background: sprite-image("lemonade/lime.png"); + } + .coffee { + background: sprite-image("other-drinks/coffee.png") no-repeat; + } + +### Compass + + + @import "lemonade/*.png"; + @import "other-drinks/*.png" + @include all-lemonade-sprites; + @include all-other-drinks-sprites; + +Compass will return class names `.lemonade-logo`, `.lemonade-lime`, `.other-drinks-coffee` + + +# Example 2 + +### Lemonade + + .lemonade-example-1 { + background: sprite-image("lemonade/example-1/blue-10x10.png", 10px, 2px); + } + +### Compass + With compass you need to flatten the image directory to be `images/lemonade` instead of `images/lemonade/example-1` + + @import "lemonade/*.png" + + .lemonade-example-1 { + @include lemonade-sprite(blue-10x10, true, 10px, 2px); + background-color: yellow; + } \ No newline at end of file diff --git a/doc-src/content/index.haml b/doc-src/content/index.haml index acd834f3..365aa750 100644 --- a/doc-src/content/index.haml +++ b/doc-src/content/index.haml @@ -62,10 +62,10 @@ layout: homepage %li %a(href="http://green.cals.cornell.edu/") %img(src="/images/sites/cornell.jpg") - %span.title Corenell University - CALS + %span.title Cornell University - CALS %span.url http://green.cals.cornell.edu %li %a(href="http://busyconf.com/") %img(src="/images/sites/busyconf.jpg") %span.title BusyConf - %span.url http://busyconf.com \ No newline at end of file + %span.url http://busyconf.com diff --git a/doc-src/content/install.haml b/doc-src/content/install.haml new file mode 100644 index 00000000..e622a4f9 --- /dev/null +++ b/doc-src/content/install.haml @@ -0,0 +1,81 @@ +--- +title: Install the Compass Stylesheet Authoring Framework +crumb: Install +body_id: install +--- +- content_for :javascripts do + %script(src="/javascripts/install.js") + +%h2 Installing Ruby +%p + Compass runs on any computer that has + ruby installed. +%p + For more advanced users you may want to install + rvm. + +%h2 Setting up the ruby environment +%ol + %li $ gem update --system + %li $ gem install compass + +%h2 Tell us about your project and we'll help you get it set up: +%blockquote.madlib.customizable< + I would like to set up my + %select#existence + %option{:value => "create"} new + %option{:value => "init"} existing + %select#app-type + %option{:value => "stand-alone"} compass + %option{:value => "rails"} rails + %option{:value => "other"} other + project + with + %select#framework + %option{:value => "compass"} compass's + %option{:value => "blueprint"} blueprint's + %option{:value => "bare"} no + starter stylesheets. + %br + I prefer the + %select#syntax + %option{:value => "scss"} CSS based (SCSS) + %option{:value => "sass"} Indent based (Sass) + syntax + and would like to + %select#options + %option{:value => "default"} use compass's recommended + %option{:value => "customized"} customize my project's + directory structure. + +%h4 Thanks. Now run the following steps in your terminal: + +%p.note + Terminal newbies, read the Designer’s Guide to the OSX Command Prompt first! + +#steps + Loading... +%p.note Note: $ is a placeholder for your terminal's prompt. You don't type it. +%h4 Then follow the instructions that compass provides in the output. + +%h4 Or you can buy a GUI for Compass from Handlino. + +%h2 Next Steps +%ul + %li + %a(href="http://sass-lang.com" target="_blank") Learn about Sass + %li + %a(href="/help/tutorials/") Read our tutorials + %li + %a(href="/reference/compass/") Study the reference documentation + diff --git a/doc-src/content/posts/2011-04-24-v011-release.markdown b/doc-src/content/posts/2011-04-24-v011-release.markdown new file mode 100644 index 00000000..60b84599 --- /dev/null +++ b/doc-src/content/posts/2011-04-24-v011-release.markdown @@ -0,0 +1,141 @@ +--- +title: "Compass v0.11 is Released!" +description: "Months in the making, Compass v0.11 continues to revolutionize CSS Frameworks." +author: chris +--- + +The Compass team is proud to announce that v0.11 is released. With this release, Compass & Sass continue to revolutionize the world of CSS Frameworks bringing never-before-seen features and unmatched simplicity, quality, and flexibility to your stylesheets. + +In this post, we summarize the new features. For all the nitty gritty details, see the [CHANGELOG](/CHANGELOG/). + +Compass is Charityware. If you love this release, [please donate to the UMDF](http://umdf.org/compass) on our behalf and help find a cure for thousands of children suffering from mitochondrial disease. + +## Sass 3.1 + +This release required you to upgrade to Sass 3.1. This release brings a ton of great new features that Compass now uses and you can too! + +* Proper List Support: Space and Comma separated lists used to cause values to become strings + when passing them to mixins. Now the values in lists are preserved as their original types. +* Sass-based Functions. Define your own value functions and use them anywhere. +* Keyword Style Argument passing to Functions and Mixins. It can be hard to understand what + the values being passed to a mixin or function are for, use keyword style arguments to + make it easier to understand remember and read mixin includes. +* `@media` bubbling. Responsive design meets nested selectors! Use a media declaration anywhere and it + will be bubbled to the top level for you. + +For more information about the new Sass features, see the [Sass CHANGELOG](http://sass-lang.com/docs/yardoc/file.SASS_CHANGELOG.html). + + +## Embracing CSS3 + +The power and flexibility of CSS3 is well known and web developers and designers are finding many new and interesting ways to take advantage of it. In Compass v0.11 we have revisited each CSS3 feature to ensure the greatest ease of use and similarity to CSS3 syntax. The compass internals for managing cross-browser compatibility have been rewritten to provide a powerful platform for moving as fast as the browser implementors are. Going forward, expect small point releases to adapt to new browser support and changes much more rapidly. By default, Compass provides out-of-the-box support for **all** modern and legacy browsers as far back as IE6 and Firefox 2. But if you want slimmer stylesheets, it is [simple to configure](/reference/compass/support/) which browser support we provide. + +In this release, we embraced the CSS3 syntax as much as possible. It might seem obvious, but the Compass convention is now that all CSS3 mixin arguments should match the CSS3 syntax for their corresponding properties so that you never have to *learn* a compass CSS3 mixin. If you ever find a case where this is not true, it is a bug and we would appreciate it if you would [provide the details in a bug report](http://github.com/chriseppstein/compass/issues). After upgrading, you will encounter a number of deprecation warnings guiding you through the syntax changes. + +### Gradients Evolved + +The best example of the changes in the CSS3 module are related to gradients. In Compass v0.10 we provided two simple mixins: `linear-gradient` and `radial-gradient` for setting the `background-image` property: + + .linear { + @include linear-gradient(#FFF, #000, color-stops(#C00 25%, #0C0 75%)) + } + +This syntax was inspired by the original webkit gradient syntax but tried to simplify it to some extent. But the gradient specification has evolved and because gradients can be used anywhere an image can, so we now provide a mixin for each property that can accept gradients and the arguments +can be any legal CSS3 value for the that property: + + .linear { + @include background-image(linear-gradient(#FFF, #C00 25%, #0C0 75%, #000)) + } + +Which produces: + + .linear { + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(25%, #cc0000), color-stop(75%, #00cc00), color-stop(100%, #000000)); + background-image: -webkit-linear-gradient(#ffffff, #cc0000 25%, #00cc00 75%, #000000); + background-image: -moz-linear-gradient(#ffffff, #cc0000 25%, #00cc00 75%, #000000); + background-image: -o-linear-gradient(#ffffff, #cc0000 25%, #00cc00 75%, #000000); + background-image: linear-gradient(#ffffff, #cc0000 25%, #00cc00 75%, #000000); + } + +## Dead Simple Sprites + +Spriting has never been easier with Compass. Nico Hagenburger joined the Compass team and we have built on his popular Lemonade plugin to make Compass sprites. Existing Lemonade users will need to upgrade. + +The way they work is you place the sprite images in a folder, +import them into your stylesheet, and then you can use the sprite in your selectors in one +of several convenient ways. + +For example, let's imagine that in your project's image folder there are four icons: + +* `/icon/new.png` +* `/icon/edit.png` +* `/icon/save.png` +* `/icon/delete.png` + +The simplest way to use these icon sprites is to let compass give you a class for each sprite: + + @import "icon/*.png"; + @include all-icon-sprites; + +And you'll get the following CSS output: + + .icon-sprite, + .icon-delete, + .icon-edit, + .icon-new, + .icon-save { background: url('/images/icon-34fe0604ab.png') no-repeat; } + + .icon-delete { background-position: 0 0; } + .icon-edit { background-position: 0 -32px; } + .icon-new { background-position: 0 -64px; } + .icon-save { background-position: 0 -96px; } + +You can now apply the `icon-XXX` classes to your markup as needed. + +Of course, this is Compass which means that underneath this simple veneer is a powerful system that you can use to customize your selectors and all kinds of other scenarios involving unicorns and rainbows. Get all the details in our [Spriting Tutorial](/help/tutorials/spriting/). + +## New Typography Module + +New in this release is a typography module. Many of our utility mixins related to typography have been moved here, but the really exciting development is the addition of the [vertical rhythm module](/reference/compass/typography/vertical_rhythm/). Based on [this excellent tutorial](http://24ways.org/2006/compose-to-a-vertical-rhythm) from 24ways, it is now simpler than ever to compose to a vertical rhythm. + +## Blueprint 1.0 + +Blueprint is 1.0 now and the Compass port is updated to match the changes there. Some of the changes that blueprint made might affect your design, so if you don't want to take this upgrade, you should unpack blueprint before you upgrade: + + compass unpack blueprint + +## New Website + +As you can see, we have a spiffy new website design from Compass Core team member [Brandon](http://brandonmathis.com/). A testament to the separation of content and presentation, most of this redesign was done by throwing out our old stylesheets and building new ones. If you don't like the light text on dark background theme, you can turn on the lights by clicking the power button in the upper right hand corner of every page. + +## Much, Much More + +There's more features in this release than would fit into this post. Here's some other things you'll find in this release: + +* Custom directory and file watching (E.g. for pngcrush support) +* Compilation Callback support +* Trigonometric functions + +Read the [CHANGELOG](/CHANGELOG/) for all the details. + +Additionally, expect a point release to follow shortly with support for: + +* Rails 3.1 + +Lastly, Compass v0.11 will have point releases as needed to adapt to changes in browser support for the CSS3 module. + +## Many Thanks + +Compass wouldn't be possible without Nathan Weizenbaum and his hard work on Sass. The latest Sass release +provides a ton of great features that have made this Compass release possible. + +Compass is far to big for one person to manage it now. I'd like to thank the hard work of the Compass core team members: + +* [Eric Meyer](http://eric.oddbird.net/) +* [Brandon Mathis](http://brandonmathis.com/) +* [Scott Davis](https://github.com/jetviper21) +* [Nico Hagenburger](http://www.hagenburger.net/) + +Additionally, there were commits from 10 other great folks in this release and there's been [contributions from 68 people](https://github.com/chriseppstein/compass/contributors) in total so far. + +Lastly thanks to the hundreds, if not thousands, of users who have helped test this release and provided valuable feedback, bug reports, and documentation suggestions. Together, we are making a real stylesheet framework and simplifying the lives of web developers across the world. diff --git a/doc-src/content/posts/2011-04-26-compass-release-strategy.markdown b/doc-src/content/posts/2011-04-26-compass-release-strategy.markdown new file mode 100644 index 00000000..5850930e --- /dev/null +++ b/doc-src/content/posts/2011-04-26-compass-release-strategy.markdown @@ -0,0 +1,93 @@ +--- +title: "Compass Release Strategy" +description: "An overview of how Compass will be managing ongoing releases." +author: chris +--- + +Most of this is probably obvious, but it doesn't hurt to be explicit about such things. + +If you're interested in contributing to Compass, please read the +[Contribution Guide](http://compass-style.org/help/tutorials/contributing/). + +Versioning +---------- + +Most stable releases will be released as release candidates first +(e.g `0.11.1.rc.0`) and then made into official releases after a day +or so if they don't cause any problems. + +Sass Dependency +--------------- + +We will decouple major Compass releases from the Sass release schedule +going forward. When Sass releases happen, we will issue patches to both +stable and master branches to adjust to any deprecations and new +features after they are fully released (which means we might have the +changes waiting in a topic branch). Because Sass is very careful to not +break existing stylesheets without deprecating first, this shouldn't be +hard to pull off. + +Stylesheet Progress +------------------- + +I do not want to see the compass stylesheets get frozen again +like they did in v0.10 while waiting for the next major release. +Compass users expect us to keep up with browser developments and we will. +If this means that we need to make v0.12 become v0.13 because +the stylesheets need to make some major change, then we will do that. + +Communicating Change +-------------------- + +All new features should have tests, docs, and CHANGELOG entries +as appropriate as part of the commit. + +Additionally, we now have a compass team blog that we can use to communicate +about new features, best practices, or other Compass related stuff. +It's easy to add a post, you just drop a markdown file into +[this directory](https://github.com/chriseppstein/compass/tree/stable/doc-src/content/posts). +Guest posts are totally welcome via pull requests. + +Stable +------ + +The stable release is were code lives for the next v0.11 point release. +Commits should only go here if they are ready for release, until that +point the code should live in your compass fork or in a topic branch. + +Core team members, please use pull requests to manage the code review +process for any change of significance and get sign-off from one other +team member before committing to stable. + +Changes that can go on stable: + +* Browser support updates +* Non-breaking stylesheet changes and minor features + like new mixins or modules. +* Bug fixes + +Changes that can't go on stable: + +* New deprecations +* Major features +* Big refactors + +If you're not sure where to put something, just ask. + +Rails 3.1 support is the exception to this rule, given the timeline +assocated with that release, I will make a topic branch and we'll +merge that to stable when it's ready. + +Core team members will, after committing/merging code to stable, then merge those changes to master so it is up to date. + +Master +------ + +Master is where code goes to be ready for v0.12. This focus of this +next release is making extensions easy to make, share, discover, install, +remove, and use. Any and all ideas that you have related to this are +welcome. At a minimum, I would like to have an extension directory +app hosted on compass-style.org and make sure that compass knows about +it and can install extensions by name from there. + + diff --git a/doc-src/content/reference/compass/css3/appearance.haml b/doc-src/content/reference/compass/css3/appearance.haml new file mode 100644 index 00000000..2eb66b0f --- /dev/null +++ b/doc-src/content/reference/compass/css3/appearance.haml @@ -0,0 +1,16 @@ +--- +title: Compass Appearance +crumb: Appearance +framework: compass +stylesheet: compass/css3/_appearance.scss +meta_description: Specify the CSS3 appearance property. +layout: core +classnames: + - reference + - core + - css3 +--- +- render 'reference' do + :markdown + Provides a mixin for `appearance`. + See the CSS3 specification: [appearance](http://www.w3.org/TR/css3-ui/#appearance). diff --git a/doc-src/content/reference/compass/helpers.haml b/doc-src/content/reference/compass/helpers.haml index 340e1f45..3a8846ff 100644 --- a/doc-src/content/reference/compass/helpers.haml +++ b/doc-src/content/reference/compass/helpers.haml @@ -24,6 +24,7 @@ layout: core * [append-selector()](/reference/compass/helpers/selectors/#append-selector) * [color-stops()](/reference/compass/helpers/color-stops/) * [cos()](/reference/compass/helpers/trig/#cos) + * [css2-fallback()](/reference/compass/helpers/cross-browser/#css2-fallback) * [elements-of-type()](/reference/compass/helpers/display/) * [enumerate()](/reference/compass/helpers/selectors/#enumerate) * [font-files()](/reference/compass/helpers/font-files/) diff --git a/doc-src/content/reference/compass/helpers/cross-browser.haml b/doc-src/content/reference/compass/helpers/cross-browser.haml index f8097bd7..32396476 100644 --- a/doc-src/content/reference/compass/helpers/cross-browser.haml +++ b/doc-src/content/reference/compass/helpers/cross-browser.haml @@ -112,3 +112,14 @@ documented_functions: It is a kind of hack to sanitize the output of experimental code into a form that can be parsed by a css2.1 compliant parser. Usually this results in causing some functions to be omitted. +#css2-fallback.helper + %h3 + %a(href="#css2-fallback") + css2-fallback($value, $css2-value) + .details + %p + This function returns a value that is normally $value, + but is $css2-value when passed through the -css2() + helper function. Many of the compass css3 mixins will create a css2 fallback + value if the arguments have a css2 representation (gradients have a null css2 + representation). diff --git a/doc-src/content/reference/compass/layout.haml b/doc-src/content/reference/compass/layout.haml index 50694755..f1c0b7d5 100644 --- a/doc-src/content/reference/compass/layout.haml +++ b/doc-src/content/reference/compass/layout.haml @@ -1,10 +1,10 @@ ---- +--- title: Compass Layout crumb: Layout framework: compass sidebar: true stylesheet: compass/_layout.scss -meta_description: Page layout module. So far, this is just the sticky-footer mixin. +meta_description: Page layout module. layout: core classnames: - reference @@ -14,4 +14,3 @@ classnames: - render 'reference' do %p This module provides tools to help you with page layout. - So far, it's just the sticky-footer mixin. diff --git a/doc-src/content/reference/compass/layout/grid_background.haml b/doc-src/content/reference/compass/layout/grid_background.haml new file mode 100644 index 00000000..2d660bad --- /dev/null +++ b/doc-src/content/reference/compass/layout/grid_background.haml @@ -0,0 +1,16 @@ +--- +title: Compass Grid Backgrounds +crumb: Grid Background +framework: compass +stylesheet: compass/layout/_grid-background.scss +layout: core +classnames: + - reference + - core + - layout +--- +- render 'reference' do + %p + The grid-background mixins allow you to generate fixed, fluid and elastic + grid-images on-the-fly using css3 gradients. These can be used for testing + both horizontal and vertical grids. diff --git a/doc-src/content/reference/compass/reset-legacy.haml b/doc-src/content/reference/compass/reset-legacy.haml new file mode 100644 index 00000000..9f18b1af --- /dev/null +++ b/doc-src/content/reference/compass/reset-legacy.haml @@ -0,0 +1,27 @@ +--- +title: Compass Reset (legacy) +crumb: Reset (legacy) +framework: compass +stylesheet: compass/_reset-legacy.scss +layout: core +sidebar: true +deprecated: true +classnames: + - reference + - core + - reset +meta_description: Adds a CSS Reset into your stylesheet. +--- +- render 'reference' do + %p.warning + This import is deprecated. Please import + reset instead. + + :markdown + This module applies the [global reset](/reference/compass/reset/utilities-legacy/#mixin-global-reset) + to your stylesheet by simply importing it. + + **Note:** This module will place styles into your stylesheet by importing it. This + is not the standard behavior of a compass module but it optimizes the common use case. + If you want to control the reset, please use the mixins defined in the [reset + utilities module](/reference/compass/reset/utilities-legacy/) diff --git a/doc-src/content/reference/compass/reset-legacy/utilities-legacy.haml b/doc-src/content/reference/compass/reset-legacy/utilities-legacy.haml new file mode 100644 index 00000000..bf052936 --- /dev/null +++ b/doc-src/content/reference/compass/reset-legacy/utilities-legacy.haml @@ -0,0 +1,22 @@ +--- +title: Compass Reset Utilities (legacy) +crumb: Reset Utilities (legacy) +framework: compass +stylesheet: compass/reset/_utilities-legacy.scss +layout: core +deprecated: true +meta_description: Mixins for resetting elements. +classnames: + - reference + - core + - utilities +--- +- render 'reference' do + %p.warning + This import is deprecated. Please import + reset utilities instead. + + :markdown + These utilities are used to reset your document. The easiest way to use them + is to simply `@import "compass/reset"` which will import this module and apply + the appropriate mixins for you. diff --git a/doc-src/content/reference/compass/reset.haml b/doc-src/content/reference/compass/reset.haml index 5001a7d1..21f67fc5 100644 --- a/doc-src/content/reference/compass/reset.haml +++ b/doc-src/content/reference/compass/reset.haml @@ -19,4 +19,4 @@ meta_description: Adds a CSS Reset into your stylesheet. **Note:** This module will place styles into your stylesheet by importing it. This is not the standard behavior of a compass module but it optimizes the common use case. If you want to control the reset, please use the mixins defined in the [reset - utilities module](/reference/compass/reset/utilities/) + utilities module](/reference/compass/reset/utilities/) diff --git a/doc-src/content/reference/compass/typography.haml b/doc-src/content/reference/compass/typography.haml new file mode 100644 index 00000000..edae96af --- /dev/null +++ b/doc-src/content/reference/compass/typography.haml @@ -0,0 +1,18 @@ +--- +title: Compass Typography +crumb: Typography +framework: compass +sidebar: true +stylesheet: compass/_typography.scss +classnames: + - reference + - core + - typography +meta_description: Provides basic mixins for common typography patterns. +layout: core +nav_stylesheet: compass/_typography.scss +--- +- render 'reference' do + %p + The Compass Typography module provides some basic mixins + for common text styling patterns. diff --git a/doc-src/content/reference/compass/utilities/links.haml b/doc-src/content/reference/compass/typography/links.haml similarity index 80% rename from doc-src/content/reference/compass/utilities/links.haml rename to doc-src/content/reference/compass/typography/links.haml index f313b231..e5807e46 100644 --- a/doc-src/content/reference/compass/utilities/links.haml +++ b/doc-src/content/reference/compass/typography/links.haml @@ -2,14 +2,14 @@ title: Compass Links crumb: Links framework: compass -stylesheet: compass/utilities/_links.scss +stylesheet: compass/typography/_links.scss sidebar: true layout: core meta_description: Tools for styling anchor links. classnames: - reference - core - - utilities + - typography --- - render 'reference' do %p diff --git a/doc-src/content/reference/compass/utilities/links/hover_link.haml b/doc-src/content/reference/compass/typography/links/hover_link.haml similarity index 74% rename from doc-src/content/reference/compass/utilities/links/hover_link.haml rename to doc-src/content/reference/compass/typography/links/hover_link.haml index 74b73599..3971e39b 100644 --- a/doc-src/content/reference/compass/utilities/links/hover_link.haml +++ b/doc-src/content/reference/compass/typography/links/hover_link.haml @@ -2,12 +2,12 @@ title: Compass Hover Link crumb: Hover Link framework: compass -stylesheet: compass/utilities/links/_hover-link.scss +stylesheet: compass/typography/links/_hover-link.scss layout: core meta_description: Underline a link when you hover over it. classnames: - reference - core - - utilities + - typography --- = render 'reference' diff --git a/doc-src/content/reference/compass/utilities/links/link_colors.haml b/doc-src/content/reference/compass/typography/links/link_colors.haml similarity index 74% rename from doc-src/content/reference/compass/utilities/links/link_colors.haml rename to doc-src/content/reference/compass/typography/links/link_colors.haml index e8f90281..183626b7 100644 --- a/doc-src/content/reference/compass/utilities/links/link_colors.haml +++ b/doc-src/content/reference/compass/typography/links/link_colors.haml @@ -2,12 +2,12 @@ title: Compass Link Colors crumb: Link Colors framework: compass -stylesheet: compass/utilities/links/_link-colors.scss +stylesheet: compass/typography/links/_link-colors.scss layout: core meta_description: Easy assignment of colors to link states. classnames: - reference - core - - utilities + - typography --- = render 'reference' diff --git a/doc-src/content/reference/compass/utilities/links/unstyled_link.haml b/doc-src/content/reference/compass/typography/links/unstyled_link.haml similarity index 79% rename from doc-src/content/reference/compass/utilities/links/unstyled_link.haml rename to doc-src/content/reference/compass/typography/links/unstyled_link.haml index 54a4bcd9..79824d5c 100644 --- a/doc-src/content/reference/compass/utilities/links/unstyled_link.haml +++ b/doc-src/content/reference/compass/typography/links/unstyled_link.haml @@ -2,13 +2,13 @@ title: Compass Unstyled Link crumb: Unstyled Link framework: compass -stylesheet: compass/utilities/links/_unstyled-link.scss +stylesheet: compass/typography/links/_unstyled-link.scss layout: core meta_description: Make a link appear like regular text. classnames: - reference - core - - utilities + - typography --- - render 'reference' do %p diff --git a/doc-src/content/reference/compass/utilities/lists.haml b/doc-src/content/reference/compass/typography/lists.haml similarity index 76% rename from doc-src/content/reference/compass/utilities/lists.haml rename to doc-src/content/reference/compass/typography/lists.haml index fbe1c735..0d48b807 100644 --- a/doc-src/content/reference/compass/utilities/lists.haml +++ b/doc-src/content/reference/compass/typography/lists.haml @@ -2,13 +2,13 @@ title: Compass Lists crumb: Lists framework: compass -stylesheet: compass/utilities/_lists.scss +stylesheet: compass/typography/_lists.scss sidebar: true layout: core meta_description: Tools for styling lists. classnames: - reference - core - - utilities + - typography --- = render 'reference' diff --git a/doc-src/content/reference/compass/utilities/lists/bullets.haml b/doc-src/content/reference/compass/typography/lists/bullets.haml similarity index 73% rename from doc-src/content/reference/compass/utilities/lists/bullets.haml rename to doc-src/content/reference/compass/typography/lists/bullets.haml index 3f9c19fb..9f6e7405 100644 --- a/doc-src/content/reference/compass/utilities/lists/bullets.haml +++ b/doc-src/content/reference/compass/typography/lists/bullets.haml @@ -2,12 +2,12 @@ title: Compass Bullets crumb: Bullets framework: compass -stylesheet: compass/utilities/lists/_bullets.scss +stylesheet: compass/typography/lists/_bullets.scss layout: core meta_description: Mixins for managing list bullets. classnames: - reference - core - - utilities + - typography --- = render 'reference' diff --git a/doc-src/content/reference/compass/utilities/lists/horizontal_list.haml b/doc-src/content/reference/compass/typography/lists/horizontal_list.haml similarity index 90% rename from doc-src/content/reference/compass/utilities/lists/horizontal_list.haml rename to doc-src/content/reference/compass/typography/lists/horizontal_list.haml index 68735199..e4909a03 100644 --- a/doc-src/content/reference/compass/utilities/lists/horizontal_list.haml +++ b/doc-src/content/reference/compass/typography/lists/horizontal_list.haml @@ -2,13 +2,13 @@ title: Compass Horizontal List crumb: Horizontal List framework: compass -stylesheet: compass/utilities/lists/_horizontal-list.scss +stylesheet: compass/typography/lists/_horizontal-list.scss layout: core meta_description: Float a list so it appears horizontally. classnames: - reference - core - - utilities + - typography --- - render 'reference' do :markdown diff --git a/doc-src/content/reference/compass/utilities/lists/inline-block-list.haml b/doc-src/content/reference/compass/typography/lists/inline-block-list.haml similarity index 90% rename from doc-src/content/reference/compass/utilities/lists/inline-block-list.haml rename to doc-src/content/reference/compass/typography/lists/inline-block-list.haml index 2ce51b92..c5b8d520 100644 --- a/doc-src/content/reference/compass/utilities/lists/inline-block-list.haml +++ b/doc-src/content/reference/compass/typography/lists/inline-block-list.haml @@ -2,13 +2,13 @@ title: Compass Inline-Block List crumb: Inline-Block List framework: compass -stylesheet: compass/utilities/lists/_inline-block-list.scss +stylesheet: compass/typography/lists/_inline-block-list.scss layout: core meta_description: set list-elements to inline-block so they appear horizontally while retaining their structure. classnames: - reference - core - - utilities + - typography --- - render 'reference' do :markdown diff --git a/doc-src/content/reference/compass/utilities/lists/inline_list.haml b/doc-src/content/reference/compass/typography/lists/inline_list.haml similarity index 73% rename from doc-src/content/reference/compass/utilities/lists/inline_list.haml rename to doc-src/content/reference/compass/typography/lists/inline_list.haml index c63e5951..5b0df24f 100644 --- a/doc-src/content/reference/compass/utilities/lists/inline_list.haml +++ b/doc-src/content/reference/compass/typography/lists/inline_list.haml @@ -2,12 +2,12 @@ title: Compass Inline List crumb: Inline List framework: compass -stylesheet: compass/utilities/lists/_inline-list.scss +stylesheet: compass/typography/lists/_inline-list.scss layout: core meta_description: Style a list as inline text. classnames: - reference - core - - utilities + - typography --- = render 'reference' diff --git a/doc-src/content/reference/compass/utilities/text.haml b/doc-src/content/reference/compass/typography/text.haml similarity index 80% rename from doc-src/content/reference/compass/utilities/text.haml rename to doc-src/content/reference/compass/typography/text.haml index 2c8e918d..a2c9c2b4 100644 --- a/doc-src/content/reference/compass/utilities/text.haml +++ b/doc-src/content/reference/compass/typography/text.haml @@ -2,14 +2,14 @@ title: Compass Text crumb: Text framework: compass -stylesheet: compass/utilities/_text.scss +stylesheet: compass/typography/_text.scss layout: core sidebar: true meta_description: Style helpers for your text. classnames: - reference - core - - utilities + - typography --- - render 'reference' do %p diff --git a/doc-src/content/reference/compass/utilities/text/ellipsis.haml b/doc-src/content/reference/compass/typography/text/ellipsis.haml similarity index 85% rename from doc-src/content/reference/compass/utilities/text/ellipsis.haml rename to doc-src/content/reference/compass/typography/text/ellipsis.haml index 3ce24d74..c55bd53a 100644 --- a/doc-src/content/reference/compass/utilities/text/ellipsis.haml +++ b/doc-src/content/reference/compass/typography/text/ellipsis.haml @@ -2,13 +2,13 @@ title: Truncating Text with Ellipses crumb: Ellipsis framework: compass -stylesheet: compass/utilities/text/_ellipsis.scss +stylesheet: compass/typography/text/_ellipsis.scss layout: core meta_description: Text truncation with ellipsis. classnames: - reference - core - - utilities + - typography --- - render 'reference' do :markdown diff --git a/doc-src/content/reference/compass/utilities/text/nowrap.haml b/doc-src/content/reference/compass/typography/text/nowrap.haml similarity index 82% rename from doc-src/content/reference/compass/utilities/text/nowrap.haml rename to doc-src/content/reference/compass/typography/text/nowrap.haml index ed7be511..e945d99f 100644 --- a/doc-src/content/reference/compass/utilities/text/nowrap.haml +++ b/doc-src/content/reference/compass/typography/text/nowrap.haml @@ -2,13 +2,13 @@ title: Compass No Wrap crumb: No Wrap framework: compass -stylesheet: compass/utilities/text/_nowrap.scss +stylesheet: compass/typography/text/_nowrap.scss layout: core meta_description: Remembering whether or not there's a hyphen in white-space is too hard. classnames: - reference - core - - utilities + - typography --- - render 'reference' do %p diff --git a/doc-src/content/reference/compass/utilities/text/replacement.haml b/doc-src/content/reference/compass/typography/text/replacement.haml similarity index 73% rename from doc-src/content/reference/compass/utilities/text/replacement.haml rename to doc-src/content/reference/compass/typography/text/replacement.haml index 239e0986..70712a9f 100644 --- a/doc-src/content/reference/compass/utilities/text/replacement.haml +++ b/doc-src/content/reference/compass/typography/text/replacement.haml @@ -2,12 +2,12 @@ title: Compass Text Replacement crumb: Text Replacement framework: compass -stylesheet: compass/utilities/text/_replacement.scss +stylesheet: compass/typography/text/_replacement.scss layout: core meta_description: Replace text with images. classnames: - reference - core - - utilities + - typography --- = render 'reference' \ No newline at end of file diff --git a/doc-src/content/reference/compass/typography/vertical_rhythm.haml b/doc-src/content/reference/compass/typography/vertical_rhythm.haml new file mode 100644 index 00000000..01a595fa --- /dev/null +++ b/doc-src/content/reference/compass/typography/vertical_rhythm.haml @@ -0,0 +1,20 @@ +--- +title: Vertical Rhythm +crumb: Vertical Rhythm +framework: compass +stylesheet: compass/typography/_vertical_rhythm.scss +layout: core +meta_description: Create and maintain a vertical rhythm for your type. +classnames: + - reference + - core + - typography +--- +- render 'reference' do + :markdown + Create a vertical rhythm for your site by setting the `$base-font-size` and + `$base-line-height` variables and then including the `establish-baseline` + mixin at the root of your document. + + Manage the vertical rhythm using the other vertical-rhythm mixins to adjust + font and line-height values, extra vertical whitespace, borders, etc. diff --git a/doc-src/content/reference/compass/utilities/color.haml b/doc-src/content/reference/compass/utilities/color.haml new file mode 100644 index 00000000..c0fb5803 --- /dev/null +++ b/doc-src/content/reference/compass/utilities/color.haml @@ -0,0 +1,16 @@ +--- +title: Compass Color +crumb: Color +framework: compass +stylesheet: compass/utilities/_color.scss +layout: core +sidebar: true +meta_description: Utilities for working with colors. +classnames: + - reference + - core + - utilities +--- +- render 'reference' do + %p + Utilities for working with colors. diff --git a/doc-src/content/reference/compass/utilities/color/contrast.haml b/doc-src/content/reference/compass/utilities/color/contrast.haml new file mode 100644 index 00000000..327d5b6d --- /dev/null +++ b/doc-src/content/reference/compass/utilities/color/contrast.haml @@ -0,0 +1,13 @@ +--- +title: Compass Color Contrast +crumb: Color Contrast +framework: compass +stylesheet: compass/utilities/color/_contrast.scss +layout: core +meta_description: Contrast foreground with background colors. +classnames: + - reference + - core + - utilities +--- += render 'reference' diff --git a/doc-src/content/reference/compass/utilities/sprites.haml b/doc-src/content/reference/compass/utilities/sprites.haml index 5b1bd949..25202a24 100644 --- a/doc-src/content/reference/compass/utilities/sprites.haml +++ b/doc-src/content/reference/compass/utilities/sprites.haml @@ -11,5 +11,13 @@ classnames: - core - utilities --- -= render 'reference' +- render 'reference' do + %h3 Additional Resources + %ul + %li + %a(href="/help/tutorials/spriting/") Spriting Tutorial + %li + %a(href="/reference/compass/helpers/sprites/") Sprite Helpers + %li + %a(href="/reference/compass/utilities/sprites/base/") Base Stylesheet \ No newline at end of file diff --git a/doc-src/content/reference/compass/utilities/sprites/sprite_img.haml b/doc-src/content/reference/compass/utilities/sprites/sprite_img.haml index 8f51a96f..177c6604 100644 --- a/doc-src/content/reference/compass/utilities/sprites/sprite_img.haml +++ b/doc-src/content/reference/compass/utilities/sprites/sprite_img.haml @@ -16,14 +16,14 @@ classnames: a.twitter +sprite-img("icons-32.png", 1) a.facebook - +sprite-img("icons-32png", 2) + +sprite-img("icons-32.png", 2) **Example 2** Sharing a common base: a +sprite-background("icons-32.png") - a.twitter + &.twitter +sprite-column(1) - a.facebook + &.facebook +sprite-row(2) \ No newline at end of file diff --git a/doc-src/content/stylesheets/partials/_blog.scss b/doc-src/content/stylesheets/partials/_blog.scss new file mode 100644 index 00000000..ac79d58d --- /dev/null +++ b/doc-src/content/stylesheets/partials/_blog.scss @@ -0,0 +1,6 @@ +body#blog-archive { + .timestamp { + margin-right: 1em; + font-size: 12px; + } +} \ No newline at end of file diff --git a/doc-src/content/stylesheets/partials/_install.scss b/doc-src/content/stylesheets/partials/_install.scss new file mode 100644 index 00000000..353a2df8 --- /dev/null +++ b/doc-src/content/stylesheets/partials/_install.scss @@ -0,0 +1,10 @@ +body#install { + #steps, p.madlib, p.note, h4 { margin-top: 1em; } + p.note { font-size: smaller; font-style: italic; } + p.warning { color: #c00; } + .customization { display: none; } + .customizable .customization { display: inline; } + blockquote { border-left: 2px solid #ccc; + text-indent: 0; padding-left: 0.5em; } + .customization input { width: 8em; } +} \ No newline at end of file diff --git a/doc-src/content/stylesheets/partials/_layout.scss b/doc-src/content/stylesheets/partials/_layout.scss index d9d54150..5148ac89 100644 --- a/doc-src/content/stylesheets/partials/_layout.scss +++ b/doc-src/content/stylesheets/partials/_layout.scss @@ -1,4 +1,4 @@ -$min-width: 680px; +$min-width: 700px; $side-nav-width: 160px; $main-min-width: $min-width - $side-nav-width; diff --git a/doc-src/content/stylesheets/screen.scss b/doc-src/content/stylesheets/screen.scss index 7c7777ca..1f240bdf 100644 --- a/doc-src/content/stylesheets/screen.scss +++ b/doc-src/content/stylesheets/screen.scss @@ -16,6 +16,8 @@ @import "partials/main"; @import "partials/code"; @import "partials/example"; +@import "partials/install"; +@import "partials/blog"; @import "syntax/syntax-theme"; diff --git a/doc-src/layouts/basic.haml b/doc-src/layouts/basic.haml index 20278c06..18c3670b 100644 --- a/doc-src/layouts/basic.haml +++ b/doc-src/layouts/basic.haml @@ -6,6 +6,7 @@ %meta{:content => "chrome=1", "http-equiv" => "X-UA-Compatible"} %meta(name="viewport" content="width=780") %link(rel="shortcut icon" type="image/png" href="/images/compass_icon.png") + %link{:href=>"/blog/atom.xml", :rel=>"alternate", :title=>"Compass Blog", :type=>"application/atom+xml"} %title #{@item[:title]} | Compass Documentation %link{:charset => "utf-8", :href => "/stylesheets/screen.css", :rel => "stylesheet", :type => "text/css"} diff --git a/doc-src/layouts/blog.haml b/doc-src/layouts/blog.haml new file mode 100644 index 00000000..45cdb55d --- /dev/null +++ b/doc-src/layouts/blog.haml @@ -0,0 +1,24 @@ +- render "basic" do + #wrap + = render "partials/main-navigation" + #sub-nav + - p = previous_post + - n = next_post + - if p || n + %nav#docs-nav{:role => "navigation"} + - if p + %a{:href => p.rep_named(:default).path, :title => p[:title]} « Previous Post + - if n + %a{:href => n.rep_named(:default).path, :title => n[:title]} Next Post » + #page + #docs_panel + #theme_pref + %a{:href => "#", :rel => "theme", :title => "switch theme" } Q + #version + Version: + %a.number(href="/CHANGELOG/")= compass_version + = yield + #comments= render "partials/disqus_comments" + %footer(role="contentinfo")= render "partials/footer" + = @item[:content_for_javascripts] + = render "partials/analytics" diff --git a/doc-src/layouts/main.haml b/doc-src/layouts/main.haml index 4fa5f0f7..f287370f 100644 --- a/doc-src/layouts/main.haml +++ b/doc-src/layouts/main.haml @@ -18,7 +18,7 @@ Version: %a.number(href="/CHANGELOG/")= compass_version = yield - -#comments= render "partials/disqus_comments" + #comments= render "partials/disqus_comments" %footer(role="contentinfo")= render "partials/footer" = @item[:content_for_javascripts] = render "partials/analytics" diff --git a/doc-src/layouts/partials/analytics.haml b/doc-src/layouts/partials/analytics.haml index 9fc3765f..fee2992b 100644 --- a/doc-src/layouts/partials/analytics.haml +++ b/doc-src/layouts/partials/analytics.haml @@ -16,6 +16,3 @@ (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); - \ No newline at end of file diff --git a/doc-src/layouts/partials/main-navigation.haml b/doc-src/layouts/partials/main-navigation.haml index 15d33110..b6858d0b 100644 --- a/doc-src/layouts/partials/main-navigation.haml +++ b/doc-src/layouts/partials/main-navigation.haml @@ -9,6 +9,10 @@ %li %a{:href => "/reference/compass/", :rel => "documentation"} Reference %li - %a{:href => "/help", :rel=> "help"} Help + %a{:href => "/help/", :rel=> "help"} Help %li - %a{:href => "/get-involved", :rel=> "get-involved"} Get Involved + %a{:href => "/blog/", :rel=> "blog"} Blog + %li + %a{:href => "/get-involved/", :rel=> "get-involved"} Get Involved + %li + %a{:href => "/install/", :rel=> "install"} Install diff --git a/doc-src/layouts/post.haml b/doc-src/layouts/post.haml new file mode 100644 index 00000000..daf7640b --- /dev/null +++ b/doc-src/layouts/post.haml @@ -0,0 +1,11 @@ +- render "blog" do + %h1= @item[:title] + - author = author(@item[:author]) + %h2 + By + - if author["byline_link"] + %a{:href=>author["byline_link"]}= author["fullname"] + - else + = author["fullname"] + = yield + -#comments= render "partials/disqus_comments" \ No newline at end of file diff --git a/doc-src/lib/blog.rb b/doc-src/lib/blog.rb new file mode 100644 index 00000000..214776ef --- /dev/null +++ b/doc-src/lib/blog.rb @@ -0,0 +1,37 @@ +POST_NAME = %r{^/posts/(\d{4})-(\d{2})-(\d{2})-(.*)/$} +require 'time' +require 'yaml' + +def blog_posts_in_order + @blog_posts_in_order ||= @items.select {|i| i.identifier =~ %r{/posts} }.sort_by {|i| i.identifier } +end + +def previous_post(item = @item) + current_index = blog_posts_in_order.index(item) + if current_index && current_index > 0 + blog_posts_in_order[current_index - 1] + end +end + +def next_post(item = @item) + current_index = blog_posts_in_order.index(item) + if current_index && current_index < blog_posts_in_order.size - 1 + blog_posts_in_order[current_index + 1] + end +end + +def blog_date(item = @item) + if item.identifier =~ POST_NAME + Time.new($1.to_i, $2.to_i, $3.to_i) + end +end + +def authors + @site.cached("authors") do + YAML.load_file("#{File.dirname(__FILE__)}/../authors.yml") + end +end + +def author(author_id) + authors[author_id] +end diff --git a/doc-src/lib/default.rb b/doc-src/lib/default.rb index 46b98745..a2a5c782 100644 --- a/doc-src/lib/default.rb +++ b/doc-src/lib/default.rb @@ -132,3 +132,7 @@ def compass_version "#{v[:major]}.#{v[:minor]}#{"."+v[:state] if v[:state]}.#{v[:build]}" end +def long_compass_version + require 'compass/commands' + Compass::Commands::PrintVersion.long_output_string +end \ No newline at end of file diff --git a/doc-src/lib/search.rb b/doc-src/lib/search.rb index aadde495..f5f5d47b 100644 --- a/doc-src/lib/search.rb +++ b/doc-src/lib/search.rb @@ -66,7 +66,7 @@ def search_index # puts "Indexed: #{term}" end idx["items"][id] = { - "url" => "/docs#{item.identifier}", + "url" => "#{item.identifier}", "title" => item[:title], "crumb" => item[:crumb] } diff --git a/examples/compass/src/utilities.scss b/examples/compass/src/utilities.scss index 069c067b..b3461431 100644 --- a/examples/compass/src/utilities.scss +++ b/examples/compass/src/utilities.scss @@ -3,7 +3,7 @@ @import "yui/modules/base"; @import "blueprint/grid"; @import "blueprint/scaffolding"; -@import "compass/utilities/text/ellipsis"; +@import "compass/typography/text/ellipsis"; html { @include yui-base; } @@ -55,7 +55,7 @@ h2 { ul.inline { @include inline-list; } ul.comma-delimited { - @include comma-delimited-list; } + @include delimited-list; } ol.pretty { @include pretty-bullets("blue_arrow.gif", 5px, 7px, 18px); } } diff --git a/features/extensions.feature b/features/extensions.feature index eaed66fb..079fa53c 100644 --- a/features/extensions.feature +++ b/features/extensions.feature @@ -20,3 +20,10 @@ Feature: Extensions When I run: compass frameworks Then the list of frameworks includes "testing" + @listframeworks + Scenario: Shared extensions directory + Given I am using the existing project in test/fixtures/stylesheets/compass + And the "~/.compass/extensions" directory exists + And and I have a fake extension at ~/.compass/extensions/testing + When I run: compass frameworks + Then the list of frameworks includes "testing" diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 26bd9bd1..5127af25 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -193,7 +193,7 @@ end Then /^the following configuration properties are set in ([^ ]+):$/ do |config_file, table| - config = Compass::Configuration::Data.new_from_file(config_file) + config = Compass::Configuration::FileData.new_from_file(config_file) table.hashes.each do |hash| config.send(hash['property']).should == hash['value'] end diff --git a/frameworks/blueprint/stylesheets/blueprint/_debug.scss b/frameworks/blueprint/stylesheets/blueprint/_debug.scss index 1628a2a7..414fa1a5 100644 --- a/frameworks/blueprint/stylesheets/blueprint/_debug.scss +++ b/frameworks/blueprint/stylesheets/blueprint/_debug.scss @@ -1,8 +1,25 @@ -@mixin showgrid($image: "grid.png") { - background: image-url($image); +@import "compass/layout/grid-background"; +@import "blueprint/grid"; + +// Shows a background that can be used to check grid alignment. +// By default this is a pure css version that only works in browsers +// that support gradients and multiple backgrounds, but you can pass +// an image url if you prefer. +@mixin showgrid($image: false) { + @if $image { + background: image-url($image); + } + @else { + @include grid-background( + $total : $blueprint-grid-columns, + $column : $blueprint-grid-width, + $gutter : $blueprint-grid-margin, + $baseline : 20px + ); + } } -@mixin blueprint-debug($grid-image: "grid.png") { +@mixin blueprint-debug($grid-image: false) { // Use this class on any column or container to see the grid. // TODO: prefix this with the project path. .showgrid { diff --git a/frameworks/blueprint/stylesheets/blueprint/_typography.scss b/frameworks/blueprint/stylesheets/blueprint/_typography.scss index 173da561..b2bc7be4 100644 --- a/frameworks/blueprint/stylesheets/blueprint/_typography.scss +++ b/frameworks/blueprint/stylesheets/blueprint/_typography.scss @@ -1,5 +1,5 @@ @import "colors"; -@import "compass/utilities/links/link-colors"; +@import "compass/typography/links/link-colors"; @import "compass/utilities/general/float"; $blueprint-font-family: "Helvetica Neue", Arial, Helvetica, sans-serif !default; diff --git a/frameworks/blueprint/stylesheets/blueprint/_utilities.scss b/frameworks/blueprint/stylesheets/blueprint/_utilities.scss index 12b89870..68e2b3de 100644 --- a/frameworks/blueprint/stylesheets/blueprint/_utilities.scss +++ b/frameworks/blueprint/stylesheets/blueprint/_utilities.scss @@ -1,4 +1,4 @@ -@import "compass/utilities/text/nowrap"; +@import "compass/typography/text/nowrap"; @import "compass/utilities/general/clearfix"; // Most of these utility classes are not "semantic". If you use them, diff --git a/frameworks/compass/stylesheets/_compass.scss b/frameworks/compass/stylesheets/_compass.scss index c3eeb8ac..9b741c0f 100644 --- a/frameworks/compass/stylesheets/_compass.scss +++ b/frameworks/compass/stylesheets/_compass.scss @@ -1,2 +1,3 @@ @import "compass/utilities"; +@import "compass/typography"; @import "compass/css3"; diff --git a/frameworks/compass/stylesheets/compass/_css3.scss b/frameworks/compass/stylesheets/compass/_css3.scss index 41f0447f..3ca84aa0 100644 --- a/frameworks/compass/stylesheets/compass/_css3.scss +++ b/frameworks/compass/stylesheets/compass/_css3.scss @@ -14,3 +14,4 @@ @import "css3/font-face"; @import "css3/transform"; @import "css3/transition"; +@import "css3/appearance"; \ No newline at end of file diff --git a/frameworks/compass/stylesheets/compass/_layout.scss b/frameworks/compass/stylesheets/compass/_layout.scss index fbbf7aad..55bf9ee7 100644 --- a/frameworks/compass/stylesheets/compass/_layout.scss +++ b/frameworks/compass/stylesheets/compass/_layout.scss @@ -1,2 +1,3 @@ +@import "layout/grid-background"; @import "layout/sticky-footer"; @import "layout/stretching"; diff --git a/frameworks/compass/stylesheets/compass/_reset-legacy.scss b/frameworks/compass/stylesheets/compass/_reset-legacy.scss new file mode 100644 index 00000000..f11f07ac --- /dev/null +++ b/frameworks/compass/stylesheets/compass/_reset-legacy.scss @@ -0,0 +1,3 @@ +@import "reset/utilities-legacy"; + +@include global-reset; diff --git a/frameworks/compass/stylesheets/compass/_support.scss b/frameworks/compass/stylesheets/compass/_support.scss index b6cb2f19..c2a51688 100644 --- a/frameworks/compass/stylesheets/compass/_support.scss +++ b/frameworks/compass/stylesheets/compass/_support.scss @@ -17,18 +17,22 @@ $legacy-support-for-ie8: $legacy-support-for-ie !default; $legacy-support-for-ie: $legacy-support-for-ie6 or $legacy-support-for-ie7 or $legacy-support-for-ie8; // Support for mozilla in experimental css3 properties. -$experimental-support-for-mozilla : true !default; +$experimental-support-for-mozilla : true !default; // Support for webkit in experimental css3 properties. -$experimental-support-for-webkit : true !default; +$experimental-support-for-webkit : true !default; +// Support for webkit in experimental css3 properties. +$experimental-support-for-webkit : true !default; +// Support for webkit's original (non-standard) gradient syntax. +$support-for-original-webkit-gradients : true !default; // Support for opera in experimental css3 properties. -$experimental-support-for-opera : true !default; +$experimental-support-for-opera : true !default; // Support for microsoft in experimental css3 properties. -$experimental-support-for-microsoft : true !default; +$experimental-support-for-microsoft : true !default; // Support for khtml in experimental css3 properties. -$experimental-support-for-khtml : true !default; +$experimental-support-for-khtml : true !default; // Support for svg in experimental css3 properties. // Setting this to true might add significant size to your // generated stylesheets. -$experimental-support-for-svg : false !default; +$experimental-support-for-svg : false !default; // Support for CSS PIE in experimental css3 properties. -$experimental-support-for-pie : false !default; +$experimental-support-for-pie : false !default; diff --git a/frameworks/compass/stylesheets/compass/_typography.scss b/frameworks/compass/stylesheets/compass/_typography.scss new file mode 100644 index 00000000..4d9cb5d5 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/_typography.scss @@ -0,0 +1,4 @@ +@import "typography/links"; +@import "typography/lists"; +@import "typography/text"; +@import "typography/vertical_rhythm"; diff --git a/frameworks/compass/stylesheets/compass/_utilities.scss b/frameworks/compass/stylesheets/compass/_utilities.scss index fcb735ca..53a02445 100644 --- a/frameworks/compass/stylesheets/compass/_utilities.scss +++ b/frameworks/compass/stylesheets/compass/_utilities.scss @@ -1,6 +1,9 @@ +@import "utilities/color"; @import "utilities/general"; -@import "utilities/links"; -@import "utilities/lists"; @import "utilities/sprites"; @import "utilities/tables"; -@import "utilities/text"; + +// deprecated +@import "typography/links"; +@import "typography/lists"; +@import "typography/text"; diff --git a/frameworks/compass/stylesheets/compass/css3/_appearance.scss b/frameworks/compass/stylesheets/compass/css3/_appearance.scss new file mode 100644 index 00000000..128fe4d9 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/css3/_appearance.scss @@ -0,0 +1,13 @@ +@import "shared"; + +// Change the appearance for Mozilla, Webkit and the future +// +// @param $ap +// [ none | normal | icon | window | button | menu | field ] + +@mixin appearance($ap) { + $ap: unquote($ap); + @include experimental(appearance, $ap, + -moz, -webkit, not -o, not -ms, not -khtml, official + ); +} diff --git a/frameworks/compass/stylesheets/compass/css3/_background-size.scss b/frameworks/compass/stylesheets/compass/css3/_background-size.scss index a9b7a04f..9d364470 100644 --- a/frameworks/compass/stylesheets/compass/css3/_background-size.scss +++ b/frameworks/compass/stylesheets/compass/css3/_background-size.scss @@ -8,9 +8,19 @@ $default-background-size: 100% auto !default; // // * percentages are relative to the background-origin (default = padding-box) // * mixin defaults to: `$default-background-size` -@mixin background-size($size: $default-background-size) { - @if type-of($size) == string { - $size: unquote($size); - } - @include experimental(background-size, $size, -moz, -webkit, -o, not -ms, not -khtml); +@mixin background-size( + $size-1: $default-background-size, + $size-2: false, + $size-3: false, + $size-4: false, + $size-5: false, + $size-6: false, + $size-7: false, + $size-8: false, + $size-9: false, + $size-10: false +) { + $size-1: if(type-of($size-1) == string, unquote($size-1), $size-1); + $sizes: compact($size-1, $size-2, $size-3, $size-4, $size-5, $size-6, $size-7, $size-8, $size-9, $size-10); + @include experimental(background-size, $sizes, -moz, -webkit, -o, not -ms, not -khtml); } diff --git a/frameworks/compass/stylesheets/compass/css3/_font-face.scss b/frameworks/compass/stylesheets/compass/css3/_font-face.scss index f0a58788..b110d25a 100644 --- a/frameworks/compass/stylesheets/compass/css3/_font-face.scss +++ b/frameworks/compass/stylesheets/compass/css3/_font-face.scss @@ -1,4 +1,3 @@ -@charset "UTF-8"; @import "shared"; // Cross-browser support for @font-face. Supports IE, Gecko, Webkit, Opera. @@ -7,15 +6,26 @@ // * $font-files is required using font-files('relative/location', 'format'). // for best results use this order: woff, opentype/truetype, svg // * $eot is required by IE, and is a relative location of the eot file. +// * For android 2.2 Compatiblity, please ensure that your web page has +// a meta viewport tag. +// * To support iOS < 4.2, an SVG file must be provided +// +// If you need to generate other formats check out the Font Squirrel +// [font generator](http://www.fontsquirrel.com/fontface/generator) -@mixin font-face($name, $font-files, $eot: false, $postscript: false, $style: false) { - @if $postscript or $style { - @warn "The $postscript and $style variables have been deprecated in favor of the Paul Irish smiley bulletproof technique."; - } +@mixin font-face( + $name, + $font-files, + $eot: false +) { + $iefont: unquote("#{$eot}?iefix"); @font-face { font-family: quote($name); - @if $eot { src: font-url($eot); } - src: local("☺"), $font-files; + @if $eot { + src: font-url($eot); + $font-files: font-url($iefont) unquote("format('eot')"), $font-files; + } + src: $font-files; } } diff --git a/frameworks/compass/stylesheets/compass/css3/_images.scss b/frameworks/compass/stylesheets/compass/css3/_images.scss index 8ad01d43..7b36e48b 100644 --- a/frameworks/compass/stylesheets/compass/css3/_images.scss +++ b/frameworks/compass/stylesheets/compass/css3/_images.scss @@ -1,4 +1,5 @@ @import "shared"; +@import "compass/utilities/general/hacks"; // Background property support for vendor prefixing within values. @mixin background( @@ -16,15 +17,38 @@ $backgrounds: compact($background-1, $background-2, $background-3, $background-4, $background-5, $background-6, $background-7, $background-8, $background-9, $background-10); $mult-bgs: -compass-list-size($backgrounds) > 1; - $simple-background: if($mult-bgs or prefixed(-css2, $backgrounds), -css2(-compass-nth($backgrounds, last)), false); - @if not blank($simple-background) { background: $simple-background; } - @if $experimental-support-for-svg and prefixed(-svg, $backgrounds) { background: -svg($backgrounds); } - @if $experimental-support-for-webkit and prefixed(-webkit, $backgrounds) { background: -webkit($backgrounds); } - @if $experimental-support-for-mozilla and prefixed(-moz, $backgrounds) { background: -moz($backgrounds); } - @if $experimental-support-for-pie and (prefixed(-pie, $backgrounds) or $mult-bgs) { -pie-background: -pie($backgrounds); } - background: $backgrounds; + $add-pie-bg: prefixed(-pie, $backgrounds) or $mult-bgs; + @if $experimental-support-for-svg and prefixed(-svg, $backgrounds) { background: -svg($backgrounds); } + @if $support-for-original-webkit-gradients and prefixed(-owg, $backgrounds) { background: -owg($backgrounds); } + @if $experimental-support-for-webkit and prefixed(-webkit, $backgrounds) { background: -webkit($backgrounds); } + @if $experimental-support-for-mozilla and prefixed(-moz, $backgrounds) { background: -moz($backgrounds); } + @if $experimental-support-for-opera and prefixed(-o, $backgrounds) { background: -o($backgrounds); } + @if $experimental-support-for-pie and $add-pie-bg { -pie-background: -pie($backgrounds); } + background: $backgrounds ; } +@mixin background-with-css2-fallback( + $background-1, + $background-2: false, + $background-3: false, + $background-4: false, + $background-5: false, + $background-6: false, + $background-7: false, + $background-8: false, + $background-9: false, + $background-10: false +) { + $backgrounds: compact($background-1, $background-2, $background-3, $background-4, $background-5, + $background-6, $background-7, $background-8, $background-9, $background-10); + $mult-bgs: -compass-list-size($backgrounds) > 1; + $simple-background: if($mult-bgs or prefixed(-css2, $backgrounds), -css2(-compass-nth($backgrounds, last)), false); + @if not blank($simple-background) { background: $simple-background; } + @include background($background-1, $background-2, $background-3, $background-4, $background-5, + $background-6, $background-7, $background-8, $background-9, $background-10); +} + + // Background image property support for vendor prefixing within values. @mixin background-image( $image-1, @@ -39,12 +63,15 @@ $image-10: false ) { $images: compact($image-1, $image-2, $image-3, $image-4, $image-5, $image-6, $image-7, $image-8, $image-9, $image-10); + $add-pie-bg: prefixed(-pie, $images) or -compass-list-size($images) > 1; - @if $experimental-support-for-svg and prefixed(-svg, $images) { background-image: -svg($images); background-size: 100%; } - @if $experimental-support-for-webkit and prefixed(-webkit, $images) { background-image: -webkit($images); } - @if $experimental-support-for-mozilla and prefixed(-moz, $images) { background-image: -moz($images); } - @if $experimental-support-for-pie and (prefixed(-pie, $images) or -compass-list-size($images) > 1) { @warn "PIE does not support background-image. Use @include background(#{$images}) instead." } - background-image: $images ; + @if $experimental-support-for-svg and prefixed(-svg, $images) { background-image: -svg($images); background-size: 100%; } + @if $support-for-original-webkit-gradients and prefixed(-owg, $images) { background-image: -owg($images); } + @if $experimental-support-for-webkit and prefixed(-webkit, $images) { background-image: -webkit($images); } + @if $experimental-support-for-mozilla and prefixed(-moz, $images) { background-image: -moz($images); } + @if $experimental-support-for-opera and prefixed(-o, $images) { background-image: -o($images); } + @if $experimental-support-for-pie and $add-pie-bg { @warn "PIE does not support background-image. Use @include background(#{$images}) instead." } + background-image: $images ; } // Emit a IE-Specific filters that renders a simple linear gradient. @@ -65,34 +92,42 @@ // Border image property support for vendor prefixing properties and values. @mixin border-image($value) { - @if $experimental-support-for-mozilla { -moz-border-image: -moz(-compass-list($value)); } - @if $experimental-support-for-webkit { -webkit-border-image: -webkit(-compass-list($value)); } - @if $experimental-support-for-svg { border-image: -svg(-compass-list($value)); } - border-image: $value; + @if $experimental-support-for-mozilla { -moz-border-image: -moz(-compass-list($value)); } + @if $support-for-original-webkit-gradients { -webkit-border-image: -owg(-compass-list($value)); } + @if $experimental-support-for-webkit { -webkit-border-image: -webkit(-compass-list($value)); } + @if $experimental-support-for-opera { -o-border-image: -o(-compass-list($value)); } + @if $experimental-support-for-svg { border-image: -svg(-compass-list($value)); } + border-image: $value; } // List style image property support for vendor prefixing within values. @mixin list-style-image($image) { - @if $experimental-support-for-mozilla and prefixed(-moz, $image) { list-style-image: -moz($image); } - @if $experimental-support-for-webkit and prefixed(-webkit, $image) { list-style-image: -webkit($image); } - @if $experimental-support-for-svg and prefixed(-svg, $image) { list-style-image: -svg($image); } - list-style-image: $image ; + @if $experimental-support-for-mozilla and prefixed(-moz, $image) { list-style-image: -moz($image); } + @if $support-for-original-webkit-gradients and prefixed(-owg, $image) { list-style-image: -owg($image); } + @if $experimental-support-for-webkit and prefixed(-webkit, $image) { list-style-image: -webkit($image); } + @if $experimental-support-for-opera and prefixed(-o, $image) { list-style-image: -o($image); } + @if $experimental-support-for-svg and prefixed(-svg, $image) { list-style-image: -svg($image); } + list-style-image: $image ; } // List style property support for vendor prefixing within values. @mixin list-style($value) { $value: -compass-list($value); - @if $experimental-support-for-mozilla and prefixed(-moz, $value) { list-style-image: -moz($value); } - @if $experimental-support-for-webkit and prefixed(-webkit, $value) { list-style-image: -webkit($value); } - @if $experimental-support-for-svg and prefixed(-svg, $value) { list-style-image: -svg($value); } - list-style-image: $value ; + @if $experimental-support-for-mozilla and prefixed(-moz, $value) { list-style-image: -moz($value); } + @if $support-for-original-webkit-gradients and prefixed(-owg, $value) { list-style-image: -owg($value); } + @if $experimental-support-for-webkit and prefixed(-webkit, $value) { list-style-image: -webkit($value); } + @if $experimental-support-for-opera and prefixed(-o, $value) { list-style-image: -o($value); } + @if $experimental-support-for-svg and prefixed(-svg, $value) { list-style-image: -svg($value); } + list-style-image: $value ; } // content property support for vendor prefixing within values. @mixin content($value) { $value: -compass-list($value); - @if $experimental-support-for-mozilla and prefixed(-moz, $value) { content: -moz($value); } - @if $experimental-support-for-webkit and prefixed(-webkit, $value) { content: -webkit($value); } - @if $experimental-support-for-svg and prefixed(-svg, $value) { content: -svg($value); } - content: $value ; + @if $experimental-support-for-mozilla and prefixed(-moz, $value) { content: -moz($value); } + @if $support-for-original-webkit-gradients and prefixed(-owg, $value) { content: -owg($value); } + @if $experimental-support-for-webkit and prefixed(-webkit, $value) { content: -webkit($value); } + @if $experimental-support-for-opera and prefixed(-o, $value) { content: -o($value); } + @if $experimental-support-for-svg and prefixed(-svg, $value) { content: -svg($value); } + content: $value ; } diff --git a/frameworks/compass/stylesheets/compass/css3/_transform.scss b/frameworks/compass/stylesheets/compass/css3/_transform.scss index e6fa3b4b..ceb18271 100644 --- a/frameworks/compass/stylesheets/compass/css3/_transform.scss +++ b/frameworks/compass/stylesheets/compass/css3/_transform.scss @@ -198,10 +198,10 @@ $default-skew-y : 5deg !default; // // @include transform-style( [ style ] ) // -// where `style` can be either `flat` or `preserves-3d` -// browsers default to `flat`, mixin defaults to `preserves-3d` -@mixin transform-style($style: preserves-3d) { - @include experimental(perspective-origin, $style, +// where `style` can be either `flat` or `preserve-3d` +// browsers default to `flat`, mixin defaults to `preserve-3d` +@mixin transform-style($style: preserve-3d) { + @include experimental(transform-style, $style, not -moz, -webkit, not -o, not -ms, not -khtml, official ); } diff --git a/frameworks/compass/stylesheets/compass/layout/_grid-background.scss b/frameworks/compass/stylesheets/compass/layout/_grid-background.scss new file mode 100644 index 00000000..e7e7306e --- /dev/null +++ b/frameworks/compass/stylesheets/compass/layout/_grid-background.scss @@ -0,0 +1,178 @@ +@import "compass/css3/images"; +@import "compass/css3/background-size"; + +// Set the color of your columns +$grid-background-column-color : rgba(100, 100, 225, 0.25) !default; +// Set the color of your gutters +$grid-background-gutter-color : rgba(0, 0, 0, 0) !default; + +// Set the total number of columns in your grid +$grid-background-total-columns : 24 !default; +// Set the width of your columns +$grid-background-column-width : 30px !default; +// Set the width of your gutters +$grid-background-gutter-width : 10px !default; +// Set the offset, if your columns are padded in from the container edge +$grid-background-offset : 0px !default; + +// Set the color of your baseline +$grid-background-baseline-color : rgba(0, 0, 0, 0.5) !default; +// Set the height of your baseline grid +$grid-background-baseline-height : 1.5em !default; + +// toggle your columns grids on and off +$show-column-grid-backgrounds : true !default; +// toggle your vertical grids on and off +$show-baseline-grid-backgrounds : true !default; +// toggle all your grids on and off +$show-grid-backgrounds : true !default; + +// optionally force your grid-image to remain fluid +// no matter what units you used to declared your grid. +$grid-background-force-fluid : false !default; + + +// Create the gradient needed for baseline grids +@function get-baseline-gradient( + $color : $grid-background-baseline-color +) { + $gradient: linear-gradient(bottom, $color 5%, rgba($color,0) 5%); + @return $gradient; +} + +// Create the color-stops needed for horizontal grids +@function build-grid-background( + $total : $grid-background-total-columns, + $column : $grid-background-column-width, + $gutter : $grid-background-gutter-width, + $offset : $grid-background-offset, + $column-color : $grid-background-column-color, + $gutter-color : $grid-background-gutter-color +) { + $grid: compact(); + $grid: append($grid, $gutter-color $offset, comma); + @for $i from 0 to $total { + + // $a represents the start of this column, initially equal to the offset + $a: $offset; + @if $i > 0 { $a: $a + (($column + $gutter) * $i); } + + // $g represents the start of this gutter, equal to $a plus one column-width + $g: $a + $column; + + // $z represents the end of a gutter, equal to $g plus one gutter-width + $z: $g + $gutter; + + @if (unit($a) == "%") and ($i == ($total - 1)) { + $z: 100%; + } + + // and we add this column/gutter pair to our grid + $grid: join($grid, ($column-color $a, $column-color $g, $gutter-color $g, $gutter-color $z)); + } + + @return $grid; +} + +// Return the gradient needed for horizontal grids +@function get-column-gradient( + $total : $grid-background-total-columns, + $column : $grid-background-column-width, + $gutter : $grid-background-gutter-width, + $offset : $grid-background-offset, + $column-color : $grid-background-column-color, + $gutter-color : $grid-background-gutter-color, + $force-fluid : $grid-background-force-fluid +) { + $grid: unquote(""); + + // don't force fluid grids when they are already fluid. + @if unit($column) == "%" { $force-fluid: false; } + + @if $force-fluid { + $grid: get-column-fluid-grid($total,$column,$gutter,$offset,$column-color,$gutter-color); + } @else { + $grid: build-grid-background($total,$column,$gutter,$offset,$column-color,$gutter-color); + } + + // return the horizontal grid as a gradient + $gradient: linear-gradient(left, $grid); + @return $gradient; +} + +// Convert a grid from fixed units into percentages. +@function get-column-fluid-grid( + $total : $grid-background-total-columns, + $column : $grid-background-column-width, + $gutter : $grid-background-gutter-width, + $offset : $grid-background-offset, + $column-color : $grid-background-column-color, + $gutter-color : $grid-background-gutter-color +) { + $context: ($column * $total) + ($gutter * ($total - 1) + ($offset * 2)); + $offset: $offset / $context * 100%; + $column: $column / $context * 100%; + $gutter: $gutter / $context * 100%; + + // return the horizontal grid as a set of color-stops + $grid: build-grid-background($total,$column,$gutter,$offset,$column-color,$gutter-color); + @return $grid; +} + + +// Add just the baseline grid to an element's background +@mixin baseline-grid-background( + $baseline : $grid-background-baseline-height, + $color : $grid-background-baseline-color +) { + @if $show-grid-backgrounds and $show-baseline-grid-backgrounds { + @include background-image(get-baseline-gradient($color)); + @include background-size(100% $baseline); + background-position: left top; + } +} + +// Add just the horizontal grid to an element's background +@mixin column-grid-background( + $total : $grid-background-total-columns, + $column : $grid-background-column-width, + $gutter : $grid-background-gutter-width, + $offset : $grid-background-offset, + $column-color : $grid-background-column-color, + $gutter-color : $grid-background-gutter-color, + $force-fluid : $grid-background-force-fluid +) { + @if $show-grid-backgrounds and $show-column-grid-backgrounds { + @include background-image( + get-column-gradient($total,$column,$gutter,$offset,$column-color,$gutter-color, $force-fluid) + ); + background-position: left top; + } +} + +// Add both horizontal and baseline grids to an element's background +@mixin grid-background( + $total : $grid-background-total-columns, + $column : $grid-background-column-width, + $gutter : $grid-background-gutter-width, + $baseline : $grid-background-baseline-height, + $offset : $grid-background-offset, + $column-color : $grid-background-column-color, + $gutter-color : $grid-background-gutter-color, + $baseline-color : $grid-background-baseline-color, + $force-fluid : $grid-background-force-fluid +) { + @if $show-grid-backgrounds { + @if $show-baseline-grid-backgrounds and $show-column-grid-backgrounds { + @include background-image( + get-baseline-gradient($baseline-color), + get-column-gradient($total,$column,$gutter,$offset,$column-color,$gutter-color, $force-fluid) + ); + @include background-size(100% $baseline, auto); + background-position: left top; + } @else { + @include baseline-grid-background($baseline, $baseline-color); + @include column-grid-background($total,$column,$gutter,$offset,$column-color,$gutter-color, $force-fluid); + } + } +} diff --git a/frameworks/compass/stylesheets/compass/reset/_utilities-legacy.scss b/frameworks/compass/stylesheets/compass/reset/_utilities-legacy.scss new file mode 100644 index 00000000..268e0f9f --- /dev/null +++ b/frameworks/compass/stylesheets/compass/reset/_utilities-legacy.scss @@ -0,0 +1,135 @@ +// Based on [Eric Meyer's reset](http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/) +// Global reset rules. +// For more specific resets, use the reset mixins provided below +// +// *Please Note*: tables still need `cellspacing="0"` in the markup. +@mixin global-reset { + html, body, div, span, applet, object, iframe, + h1, h2, h3, h4, h5, h6, p, blockquote, pre, + a, abbr, acronym, address, big, cite, code, + del, dfn, em, font, img, ins, kbd, q, s, samp, + small, strike, strong, sub, sup, tt, var, + dl, dt, dd, ol, ul, li, + fieldset, form, label, legend, + table, caption, tbody, tfoot, thead, tr, th, td { + @include reset-box-model; + @include reset-font; } + body { + @include reset-body; } + ol, ul { + @include reset-list-style; } + table { + @include reset-table; } + caption, th, td { + @include reset-table-cell; } + q, blockquote { + @include reset-quotation; } + a img { + @include reset-image-anchor-border; } } + +// Reset all elements within some selector scope. To reset the selector itself, +// mixin the appropriate reset mixin for that element type as well. This could be +// useful if you want to style a part of your page in a dramatically different way. +// +// *Please Note*: tables still need `cellspacing="0"` in the markup. +@mixin nested-reset { + div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, + pre, a, abbr, acronym, address, code, del, dfn, em, img, + dl, dt, dd, ol, ul, li, fieldset, form, label, legend, caption, tbody, tfoot, thead, tr { + @include reset-box-model; + @include reset-font; } + table { + @include reset-table; } + caption, th, td { + @include reset-table-cell; } + q, blockquote { + @include reset-quotation; } + a img { + @include reset-image-anchor-border; } } + +// Reset the box model measurements. +@mixin reset-box-model { + margin: 0; + padding: 0; + border: 0; + outline: 0; } + +// Reset the font and vertical alignment. +@mixin reset-font { + font: { + weight: inherit; + style: inherit; + size: 100%; + family: inherit; }; + vertical-align: baseline; } + +// Resets the outline when focus. +// For accessibility you need to apply some styling in its place. +@mixin reset-focus { + outline: 0; } + +// Reset a body element. +@mixin reset-body { + line-height: 1; + color: black; + background: white; } + +// Reset the list style of an element. +@mixin reset-list-style { + list-style: none; } + +// Reset a table +@mixin reset-table { + border-collapse: separate; + border-spacing: 0; + vertical-align: middle; } + +// Reset a table cell (`th`, `td`) +@mixin reset-table-cell { + text-align: left; + font-weight: normal; + vertical-align: middle; } + +// Reset a quotation (`q`, `blockquote`) +@mixin reset-quotation { + quotes: "" ""; + &:before, &:after { + content: ""; } } + +// Resets the border. +@mixin reset-image-anchor-border { + border: none; } + +// Unrecognized elements are displayed inline. +// This reset provides a basic reset for html5 elements +// so they are rendered correctly in browsers that don't recognize them +// and reset in browsers that have default styles for them. +@mixin reset-html5 { + article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary { + @include reset-box-model; + display: block; } } + +// Resets the display of inline and block elements to their default display +// according to their tag type. Elements that have a default display that varies across +// versions of html or browser are not handled here, but this covers the 90% use case. +// Usage Example: +// +// // Turn off the display for both of these classes +// .unregistered-only, .registered-only +// display: none +// // Now turn only one of them back on depending on some other context. +// body.registered +// +reset-display(".registered-only") +// body.unregistered +// +reset-display(".unregistered-only") +@mixin reset-display($selector: "", $important: false) { + #{append-selector(elements-of-type("inline"), $selector)} { + @if $important { + display: inline !important; } + @else { + display: inline; } } + #{append-selector(elements-of-type("block"), $selector)} { + @if $important { + display: block !important; } + @else { + display: block; } } } diff --git a/frameworks/compass/stylesheets/compass/reset/_utilities.scss b/frameworks/compass/stylesheets/compass/reset/_utilities.scss index 268e0f9f..cd593cfa 100644 --- a/frameworks/compass/stylesheets/compass/reset/_utilities.scss +++ b/frameworks/compass/stylesheets/compass/reset/_utilities.scss @@ -1,17 +1,20 @@ -// Based on [Eric Meyer's reset](http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/) +// Based on [Eric Meyer's reset 2.0](http://meyerweb.com/eric/tools/css/reset/index.html) // Global reset rules. // For more specific resets, use the reset mixins provided below -// -// *Please Note*: tables still need `cellspacing="0"` in the markup. @mixin global-reset { html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, - del, dfn, em, font, img, ins, kbd, q, s, samp, + del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, + b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, - table, caption, tbody, tfoot, thead, tr, th, td { + table, caption, tbody, tfoot, thead, tr, th, td, + article, aside, canvas, details, embed, + figure, figcaption, footer, header, hgroup, + menu, nav, output, ruby, section, summary, + time, mark, audio, video { @include reset-box-model; @include reset-font; } body { @@ -25,17 +28,26 @@ q, blockquote { @include reset-quotation; } a img { - @include reset-image-anchor-border; } } + @include reset-image-anchor-border; } + @include reset-html5; } // Reset all elements within some selector scope. To reset the selector itself, // mixin the appropriate reset mixin for that element type as well. This could be // useful if you want to style a part of your page in a dramatically different way. -// -// *Please Note*: tables still need `cellspacing="0"` in the markup. @mixin nested-reset { - div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, - pre, a, abbr, acronym, address, code, del, dfn, em, img, - dl, dt, dd, ol, ul, li, fieldset, form, label, legend, caption, tbody, tfoot, thead, tr { + div, span, applet, object, iframe, + h1, h2, h3, h4, h5, h6, p, blockquote, pre, + a, abbr, acronym, address, big, cite, code, + del, dfn, em, img, ins, kbd, q, s, samp, + small, strike, strong, sub, sup, tt, var, + b, u, i, center, + dl, dt, dd, ol, ul, li, + fieldset, form, label, legend, + table, caption, tbody, tfoot, thead, tr, th, td, + article, aside, canvas, details, embed, + figure, figcaption, footer, header, hgroup, + menu, nav, output, ruby, section, summary, + time, mark, audio, video { @include reset-box-model; @include reset-font; } table { @@ -51,16 +63,12 @@ @mixin reset-box-model { margin: 0; padding: 0; - border: 0; - outline: 0; } + border: 0; } // Reset the font and vertical alignment. @mixin reset-font { - font: { - weight: inherit; - style: inherit; - size: 100%; - family: inherit; }; + font-size: 100%; + font: inherit; vertical-align: baseline; } // Resets the outline when focus. @@ -70,9 +78,7 @@ // Reset a body element. @mixin reset-body { - line-height: 1; - color: black; - background: white; } + line-height: 1; } // Reset the list style of an element. @mixin reset-list-style { @@ -80,9 +86,8 @@ // Reset a table @mixin reset-table { - border-collapse: separate; - border-spacing: 0; - vertical-align: middle; } + border-collapse: collapse; + border-spacing: 0; } // Reset a table cell (`th`, `td`) @mixin reset-table-cell { @@ -92,9 +97,10 @@ // Reset a quotation (`q`, `blockquote`) @mixin reset-quotation { - quotes: "" ""; + quotes: none; &:before, &:after { - content: ""; } } + content: ""; + content: none; } } // Resets the border. @mixin reset-image-anchor-border { @@ -105,8 +111,8 @@ // so they are rendered correctly in browsers that don't recognize them // and reset in browsers that have default styles for them. @mixin reset-html5 { - article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary { - @include reset-box-model; + article, aside, details, figcaption, figure, + footer, header, hgroup, menu, nav, section { display: block; } } // Resets the display of inline and block elements to their default display diff --git a/frameworks/compass/stylesheets/compass/typography/_links.scss b/frameworks/compass/stylesheets/compass/typography/_links.scss new file mode 100644 index 00000000..735000e0 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/typography/_links.scss @@ -0,0 +1,3 @@ +@import "links/hover-link"; +@import "links/link-colors"; +@import "links/unstyled-link"; diff --git a/frameworks/compass/stylesheets/compass/typography/_lists.scss b/frameworks/compass/stylesheets/compass/typography/_lists.scss new file mode 100644 index 00000000..3365f30a --- /dev/null +++ b/frameworks/compass/stylesheets/compass/typography/_lists.scss @@ -0,0 +1,4 @@ +@import "lists/horizontal-list"; +@import "lists/inline-list"; +@import "lists/inline-block-list"; +@import "lists/bullets"; diff --git a/frameworks/compass/stylesheets/compass/typography/_text.scss b/frameworks/compass/stylesheets/compass/typography/_text.scss new file mode 100644 index 00000000..9cd3f0a1 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/typography/_text.scss @@ -0,0 +1,3 @@ +@import "text/ellipsis"; +@import "text/nowrap"; +@import "text/replacement"; diff --git a/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss b/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss new file mode 100644 index 00000000..636ae77e --- /dev/null +++ b/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss @@ -0,0 +1,133 @@ +// The base font size +$base-font-size: 16px !default; + +// The base line height is the basic unit of line hightness. +$base-line-height: 24px !default; + +// set the default border style for rhythm borders +$default-rhythm-border-style: solid !default; + +// The IE font ratio is a fact of life. Deal with it. +$ie-font-ratio: 16px / 100%; + +// The basic unit of font rhythm +$base-rhythm-unit: $base-line-height / $base-font-size * 1em; + +// The leader is the amount of whitespace in a line. +// It might be useful in your calculations +$base-leader: ($base-line-height - $base-font-size) * 1em / $base-font-size; + +// The half-leader is the amount of whitespace above and below a line. +// It might be useful in your calculations +$base-half-leader: $base-leader / 2; + +// Establishes a font baseline for the given font-size in pixels +@mixin establish-baseline($font-size: $base-font-size) { + body { + font-size: $font-size / $ie-font-ratio; + @include adjust-leading-to(1, $font-size); + } + html>body { + font-size: $font-size; + } +} + +// Show a background image that can be used to debug your alignments. +@mixin debug-vertical-alignment($img: 'underline.png') { + background: url($img); +} + +// Adjust a block to have a different font size and leading to maintain the rhythm. +// $lines is a number that is how many times the baseline rhythm this +// font size should use up. Does not have to be an integer, but it defaults +// to the smallest integer that is large enough to fit the font. +// Use $from_size to adjust from a non-base font-size. +@mixin adjust-font-size-to($to-size, $lines: ceil($to-size / $base-line-height), $from-size: $base-font-size) { + font-size: 1em * $to-size / $from-size; + @include adjust-leading-to($lines, $to-size); +} + +@mixin adjust-leading-to($lines, $font-size: $base-font-size) { + line-height: 1em * $lines * $base-line-height / $font-size; +} + +// Calculate rhythm units +@function rhythm( + $lines: 1, + $font-size: $base-font-size +) { + $rhythm: 1em * $lines * $base-line-height / $font-size; + @return $rhythm; +} + +// Apply leading whitespace +@mixin leader($lines: 1, $font-size: $base-font-size, $property: margin) { + #{$property}-top: rhythm($lines, $font-size); +} + +@mixin padding-leader($lines: 1, $font-size: $base-font-size) { + @include leader($lines, $font-size, padding); +} + +@mixin margin-leader($lines: 1, $font-size: $base-font-size) { + @include leader($lines, $font-size, margin); +} + +// Apply trailing whitespace +@mixin trailer($lines: 1, $font-size: $base-font-size, $property: margin) { + #{$property}-bottom: rhythm($lines, $font-size); +} + +@mixin padding-trailer($lines: 1, $font-size: $base-font-size) { + @include trailer($lines, $font-size, padding); +} + +@mixin margin-trailer($lines: 1, $font-size: $base-font-size) { + @include trailer($lines, $font-size, margin); +} + +// Whitespace application shortcut +// Apply top margin/padding + bottom padding/margin +@mixin rhythm($leader: 0, $padding-leader: 0, $padding-trailer: 0, $trailer: 0, $font-size: $base-font-size) { + @include leader($leader, $font-size); + @include padding-leader($padding-leader, $font-size); + @include padding-trailer($padding-trailer, $font-size); + @include trailer($trailer, $font-size); +} + +// Apply a border width to any side without destroying the vertical rhythm +@mixin apply-side-rhythm-border($side, $width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) { + border-#{$side}: { + style: $border-style; + width: 1em * $width / $font-size; + }; + padding-#{$side}: 1em / $font-size * ($lines * $base-line-height - $width); +} + +// Aplly rhythm borders equally to all sides +@mixin rhythm-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) { + border: { + style: $border-style; + width: 1em * $width / $font-size; }; + padding: 1em / $font-size * ($lines * $base-line-height - $width); +} + +// Apply a leading rhythm border +@mixin leading-border($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) { + @include apply-side-rhythm-border(top, $width, $lines, $font-size, $border-style); +} + +// Apply a trailing rhythm border +@mixin trailing-border($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) { + @include apply-side-rhythm-border(bottom, $width, $lines, $font-size, $border-style); +} + +// Apply both leading and trailing rhythm borders +@mixin horizontal-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) { + @include leading-border($width, $lines, $font-size, $border-style); + @include trailing-border($width, $lines, $font-size, $border-style); +} + +@mixin h-borders($width: 1px, $lines: 1, $font-size: $base-font-size, $border-style: $default-rhythm-border-style) { + @include horizontal-borders($width, $lines, $font-size, $border-style); +} diff --git a/frameworks/compass/stylesheets/compass/typography/links/_hover-link.scss b/frameworks/compass/stylesheets/compass/typography/links/_hover-link.scss new file mode 100644 index 00000000..8c72bc1f --- /dev/null +++ b/frameworks/compass/stylesheets/compass/typography/links/_hover-link.scss @@ -0,0 +1,5 @@ +// a link that only has an underline when you hover over it +@mixin hover-link { + text-decoration: none; + &:hover { + text-decoration: underline; } } diff --git a/frameworks/compass/stylesheets/compass/typography/links/_link-colors.scss b/frameworks/compass/stylesheets/compass/typography/links/_link-colors.scss new file mode 100644 index 00000000..5d641f78 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/typography/links/_link-colors.scss @@ -0,0 +1,28 @@ +// Set all the colors for a link with one mixin call. +// Order of arguments is: +// +// 1. normal +// 2. hover +// 3. active +// 4. visited +// 5. focus +// +// Those states not specified will inherit. +// Mixin to an anchor link like so: +// a +// +link-colors(#00c, #0cc, #c0c, #ccc, #cc0) + +@mixin link-colors($normal, $hover: false, $active: false, $visited: false, $focus: false) { + color: $normal; + @if $visited { + &:visited { + color: $visited; } } + @if $focus { + &:focus { + color: $focus; } } + @if $hover { + &:hover { + color: $hover; } } + @if $active { + &:active { + color: $active; } } } diff --git a/frameworks/compass/stylesheets/compass/typography/links/_unstyled-link.scss b/frameworks/compass/stylesheets/compass/typography/links/_unstyled-link.scss new file mode 100644 index 00000000..e39c2d67 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/typography/links/_unstyled-link.scss @@ -0,0 +1,7 @@ +// A link that looks and acts like the text it is contained within +@mixin unstyled-link { + color: inherit; + text-decoration: inherit; + cursor: inherit; + &:active, &:focus { + outline: none; } } diff --git a/frameworks/compass/stylesheets/compass/typography/lists/_bullets.scss b/frameworks/compass/stylesheets/compass/typography/lists/_bullets.scss new file mode 100644 index 00000000..aabe802a --- /dev/null +++ b/frameworks/compass/stylesheets/compass/typography/lists/_bullets.scss @@ -0,0 +1,34 @@ +// Turn off the bullet for an element of a list +@mixin no-bullet { + list-style-image : none; + list-style-type : none; + margin-left : 0px; +} + +// turns off the bullets for an entire list +@mixin no-bullets { + list-style: none; + li { @include no-bullet; } +} + +// Make a list(ul/ol) have an image bullet. +// +// The mixin should be used like this for an icon that is 5x7: +// +// ul.pretty +// +pretty-bullets("my-icon.png", 5px, 7px) +// +// Additionally, if the image dimensions are not provided, +// The image dimensions will be extracted from the image itself. +// +// ul.pretty +// +pretty-bullets("my-icon.png") +// +@mixin pretty-bullets($bullet-icon, $width: image-width($bullet-icon), $height: image-height($bullet-icon), $line-height: 18px, $padding: 14px) { + margin-left: 0; + li { + padding-left: $padding; + background: image-url($bullet-icon) no-repeat ($padding - $width) / 2 ($line-height - $height) / 2; + list-style-type: none; + } +} diff --git a/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss b/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss new file mode 100644 index 00000000..159b6599 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss @@ -0,0 +1,61 @@ +// Horizontal list layout module. +// +// Easy mode using simple descendant li selectors: +// +// ul.nav +// +horizontal-list +// +// Advanced mode: +// If you need to target the list items using a different selector then use +// +horizontal-list-container on your ul/ol and +horizontal-list-item on your li. +// This may help when working on layouts involving nested lists. For example: +// +// ul.nav +// +horizontal-list-container +// > li +// +horizontal-list-item + +@import "bullets"; +@import "compass/utilities/general/clearfix"; +@import "compass/utilities/general/reset"; +@import "compass/utilities/general/float"; + +// Can be mixed into any selector that target a ul or ol that is meant +// to have a horizontal layout. Used to implement +horizontal-list. +@mixin horizontal-list-container { + @include reset-box-model; + @include clearfix; } + +// 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 +// +// IE8 ignores rules that are included on the same line as :last-child +// see http://www.richardscarrott.co.uk/posts/view/ie8-last-child-bug for details +// +// Setting `$padding` to `false` disables the padding between list elements +@mixin horizontal-list-item($padding: 4px, $direction: left) { + @include no-bullet; + white-space: nowrap; + @include float($direction); + @if $padding { + padding: { + left: $padding; + right: $padding; + } + &:first-child, &.first { padding-#{$direction}: 0; } + &:last-child { padding-#{opposite-position($direction)}: 0; } + &.last { padding-#{opposite-position($direction)}: 0; } + } +} + +// A list(ol,ul) that is layed out such that the elements are floated left and won't wrap. +// This is not an inline list. +// +// Setting `$padding` to `false` disables the padding between list elements +@mixin horizontal-list($padding: 4px, $direction: left) { + @include horizontal-list-container; + li { + @include horizontal-list-item($padding, $direction); } } diff --git a/frameworks/compass/stylesheets/compass/typography/lists/_inline-block-list.scss b/frameworks/compass/stylesheets/compass/typography/lists/_inline-block-list.scss new file mode 100644 index 00000000..907d443a --- /dev/null +++ b/frameworks/compass/stylesheets/compass/typography/lists/_inline-block-list.scss @@ -0,0 +1,47 @@ +// Inline-Block list layout module. +// +// Easy mode using simple descendant li selectors: +// +// ul.nav +// +inline-block-list +// +// Advanced mode: +// If you need to target the list items using a different selector then use +// +inline-block-list-container on your ul/ol and +inline-block-list-item on your li. +// This may help when working on layouts involving nested lists. For example: +// +// ul.nav +// +inline-block-list-container +// > li +// +inline-block-list-item + +@import "bullets"; +@import "horizontal-list"; +@import "compass/utilities/general/float"; +@import "compass/css3/inline-block"; + +// Can be mixed into any selector that target a ul or ol that is meant +// to have an inline-block layout. Used to implement +inline-block-list. +@mixin inline-block-list-container { + @include horizontal-list-container; } + +// Can be mixed into any li selector that is meant to participate in a horizontal layout. +// Used to implement +inline-block-list. + +@mixin inline-block-list-item($padding: false) { + @include no-bullet; + @include inline-block; + white-space: nowrap; + @if $padding { + padding: { + left: $padding; + right: $padding; + }; + } +} + +// A list(ol,ul) that is layed out such that the elements are inline-block and won't wrap. +@mixin inline-block-list($padding: false) { + @include inline-block-list-container; + li { + @include inline-block-list-item($padding); } } diff --git a/frameworks/compass/stylesheets/compass/typography/lists/_inline-list.scss b/frameworks/compass/stylesheets/compass/typography/lists/_inline-list.scss new file mode 100644 index 00000000..caff6fd6 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/typography/lists/_inline-list.scss @@ -0,0 +1,44 @@ +// makes a list inline. + +@mixin inline-list { + list-style-type: none; + &, & li { + margin: 0px; + padding: 0px; + display: inline; + } +} + +// makes an inline list delimited with the passed string. +// Defaults to making a comma-separated list. +// +// Please make note of the browser support issues before using this mixin: +// +// use of `content` and `:after` is not fully supported in all browsers. +// See quirksmode for the [support matrix](http://www.quirksmode.org/css/contents.html#t15) +// +// `:last-child` is not fully supported. +// see quirksmode for the [support matrix](http://www.quirksmode.org/css/contents.html#t29). +// +// IE8 ignores rules that are included on the same line as :last-child +// see http://www.richardscarrott.co.uk/posts/view/ie8-last-child-bug for details + +@mixin delimited-list($separator: ", ") { + @include inline-list; + li { + &:after { content: $separator; } + &:last-child { + &:after { content: ""; } + } + &.last { + &:after { content: ""; } + } + } +} + +// See [delimited-list](#mixin-delimited-list) +// @deprecated +@mixin comma-delimited-list { + @warn "comma-delimited-list is deprecated. Please use delimited-list instead."; + @include delimited-list; +} diff --git a/frameworks/compass/stylesheets/compass/typography/text/_ellipsis.scss b/frameworks/compass/stylesheets/compass/typography/text/_ellipsis.scss new file mode 100644 index 00000000..3b3db25d --- /dev/null +++ b/frameworks/compass/stylesheets/compass/typography/text/_ellipsis.scss @@ -0,0 +1,25 @@ +@import "compass/css3/shared"; + +// To get full firefox support, you must install the ellipsis pattern: +// +// compass install compass/ellipsis +$use-mozilla-ellipsis-binding: false !default; + +// This technique, by [Justin Maxwell](http://code404.com/), was originally +// published [here](http://mattsnider.com/css/css-string-truncation-with-ellipsis/). +// Firefox implementation by [Rikkert Koppes](http://www.rikkertkoppes.com/thoughts/2008/6/). +@mixin ellipsis($no-wrap: true) { + @if $no-wrap { white-space: nowrap; } + overflow: hidden; + @include experimental(text-overflow, ellipsis, + not -moz, + not -webkit, + -o, + -ms, + not -khtml, + official + ); + @if $experimental-support-for-mozilla and $use-mozilla-ellipsis-binding { + -moz-binding: stylesheet-url(unquote("xml/ellipsis.xml#ellipsis")); + } +} diff --git a/frameworks/compass/stylesheets/compass/typography/text/_nowrap.scss b/frameworks/compass/stylesheets/compass/typography/text/_nowrap.scss new file mode 100644 index 00000000..1613dd67 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/typography/text/_nowrap.scss @@ -0,0 +1,2 @@ +// When remembering whether or not there's a hyphen in white-space is too hard +@mixin nowrap { white-space: nowrap; } diff --git a/frameworks/compass/stylesheets/compass/typography/text/_replacement.scss b/frameworks/compass/stylesheets/compass/typography/text/_replacement.scss new file mode 100644 index 00000000..041f1053 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/typography/text/_replacement.scss @@ -0,0 +1,34 @@ +// Hides html text and replaces it with an image. +// If you use this on an inline element, you will need to change the display to block or inline-block. +// Also, if the size of the image differs significantly from the font size, you'll need to set the width and/or height. +// +// Parameters: +// +// * `img` -- the relative path from the project image directory to the image. +// * `x` -- the x position of the background image. +// * `y` -- the y position of the background image. +@mixin replace-text($img, $x: 50%, $y: 50%) { + @include hide-text; + background: { + image: image-url($img); + repeat: no-repeat; + position: $x $y; + }; +} + +// Like the `replace-text` mixin, but also sets the width +// and height of the element according the dimensions of the image. +@mixin replace-text-with-dimensions($img, $x: 50%, $y: 50%) { + @include replace-text($img, $x, $y); + width: image-width($img); + height: image-height($img); +} + +// Hides text in an element so you can see the background. +@mixin hide-text { + $approximate_em_value: 12px / 1em; + $wider_than_any_screen: -9999em; + text-indent: $wider_than_any_screen * $approximate_em_value; + overflow: hidden; + text-align: left; +} diff --git a/frameworks/compass/stylesheets/compass/utilities/_color.scss b/frameworks/compass/stylesheets/compass/utilities/_color.scss new file mode 100644 index 00000000..0cc7fd16 --- /dev/null +++ b/frameworks/compass/stylesheets/compass/utilities/_color.scss @@ -0,0 +1 @@ +@import "color/contrast"; \ No newline at end of file diff --git a/frameworks/compass/stylesheets/compass/utilities/_links.scss b/frameworks/compass/stylesheets/compass/utilities/_links.scss index 735000e0..e0e32512 100644 --- a/frameworks/compass/stylesheets/compass/utilities/_links.scss +++ b/frameworks/compass/stylesheets/compass/utilities/_links.scss @@ -1,3 +1,5 @@ -@import "links/hover-link"; -@import "links/link-colors"; -@import "links/unstyled-link"; +@warn "This import is deprecated. Use 'compass/typography/links' instead."; + +@import "../typography/links/hover-link"; +@import "../typography/links/link-colors"; +@import "../typography/links/unstyled-link"; diff --git a/frameworks/compass/stylesheets/compass/utilities/_lists.scss b/frameworks/compass/stylesheets/compass/utilities/_lists.scss index 3365f30a..4833ee1e 100644 --- a/frameworks/compass/stylesheets/compass/utilities/_lists.scss +++ b/frameworks/compass/stylesheets/compass/utilities/_lists.scss @@ -1,4 +1,6 @@ -@import "lists/horizontal-list"; -@import "lists/inline-list"; -@import "lists/inline-block-list"; -@import "lists/bullets"; +@warn "This import is deprecated. Use 'compass/typography/lists' instead."; + +@import "../typography/lists/horizontal-list"; +@import "../typography/lists/inline-list"; +@import "../typography/lists/inline-block-list"; +@import "../typography/lists/bullets"; diff --git a/frameworks/compass/stylesheets/compass/utilities/_text.scss b/frameworks/compass/stylesheets/compass/utilities/_text.scss index 9cd3f0a1..bb73c25d 100644 --- a/frameworks/compass/stylesheets/compass/utilities/_text.scss +++ b/frameworks/compass/stylesheets/compass/utilities/_text.scss @@ -1,3 +1,5 @@ -@import "text/ellipsis"; -@import "text/nowrap"; -@import "text/replacement"; +@warn "This import is deprecated. Use 'compass/typography/text' instead."; + +@import "../typography/text/ellipsis"; +@import "../typography/text/nowrap"; +@import "../typography/text/replacement"; diff --git a/frameworks/compass/stylesheets/compass/utilities/color/_contrast.scss b/frameworks/compass/stylesheets/compass/utilities/color/_contrast.scss new file mode 100644 index 00000000..fc73905e --- /dev/null +++ b/frameworks/compass/stylesheets/compass/utilities/color/_contrast.scss @@ -0,0 +1,28 @@ +$contrasted-dark-default: #000 !default; +$contrasted-light-default: #fff !default; +$contrasted-lightness-threshold: 30% !default; + +// Returns the `$light` color when the `$color` is dark +// and the `$dark` color when the `$color` is light. +// The `$threshold` is a percent between `0%` and `100%` and it determines +// when the lightness of `$color` changes from "dark" to "light". +@function contrast-color( + $color, + $dark: $contrasted-dark-default, + $light: $contrasted-light-default, + $threshold: $contrasted-lightness-threshold +) { + @return if(lightness($color) < $threshold, $light, $dark) +} + +// Sets the specified background color and calculates a dark or light contrasted text color. +// The arguments are passed through to the [contrast-color function](#function-contrast-color). +@mixin contrasted( + $background-color, + $dark: $contrasted-dark-default, + $light: $contrasted-light-default, + $threshold: $contrasted-lightness-threshold +) { + background-color: $background-color; + color: contrast-color($background-color, $dark, $light, $threshold); +} \ No newline at end of file diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_float.scss b/frameworks/compass/stylesheets/compass/utilities/general/_float.scss index c0e2ddbf..914f184d 100644 --- a/frameworks/compass/stylesheets/compass/utilities/general/_float.scss +++ b/frameworks/compass/stylesheets/compass/utilities/general/_float.scss @@ -13,3 +13,18 @@ @mixin float($side: left) { display: inline; float: unquote($side); } + +// Resets floated elements back to their default of `float: none` and defaults +// to `display: block` unless you pass `inline` as an argument +// +// Usage Example: +// +// body.homepage +// #footer li +// +float-left +// body.signup +// #footer li +// +reset-float +@mixin reset-float($display: block) { + float: none; + display: $display; } \ No newline at end of file diff --git a/frameworks/compass/stylesheets/compass/utilities/links/_hover-link.scss b/frameworks/compass/stylesheets/compass/utilities/links/_hover-link.scss index 8c72bc1f..843459fa 100644 --- a/frameworks/compass/stylesheets/compass/utilities/links/_hover-link.scss +++ b/frameworks/compass/stylesheets/compass/utilities/links/_hover-link.scss @@ -1,5 +1,3 @@ -// a link that only has an underline when you hover over it -@mixin hover-link { - text-decoration: none; - &:hover { - text-decoration: underline; } } +@warn "This import is deprecated. Use 'compass/typography/links/hover-link' instead."; + +@import "../../typography/links/hover-link"; diff --git a/frameworks/compass/stylesheets/compass/utilities/links/_link-colors.scss b/frameworks/compass/stylesheets/compass/utilities/links/_link-colors.scss index 5d641f78..fac94387 100644 --- a/frameworks/compass/stylesheets/compass/utilities/links/_link-colors.scss +++ b/frameworks/compass/stylesheets/compass/utilities/links/_link-colors.scss @@ -1,28 +1,3 @@ -// Set all the colors for a link with one mixin call. -// Order of arguments is: -// -// 1. normal -// 2. hover -// 3. active -// 4. visited -// 5. focus -// -// Those states not specified will inherit. -// Mixin to an anchor link like so: -// a -// +link-colors(#00c, #0cc, #c0c, #ccc, #cc0) +@warn "This import is deprecated. Use 'compass/typography/links/link-colors' instead."; -@mixin link-colors($normal, $hover: false, $active: false, $visited: false, $focus: false) { - color: $normal; - @if $visited { - &:visited { - color: $visited; } } - @if $focus { - &:focus { - color: $focus; } } - @if $hover { - &:hover { - color: $hover; } } - @if $active { - &:active { - color: $active; } } } +@import "../../typography/links/link-colors"; diff --git a/frameworks/compass/stylesheets/compass/utilities/links/_unstyled-link.scss b/frameworks/compass/stylesheets/compass/utilities/links/_unstyled-link.scss index e39c2d67..1c48f468 100644 --- a/frameworks/compass/stylesheets/compass/utilities/links/_unstyled-link.scss +++ b/frameworks/compass/stylesheets/compass/utilities/links/_unstyled-link.scss @@ -1,7 +1,3 @@ -// A link that looks and acts like the text it is contained within -@mixin unstyled-link { - color: inherit; - text-decoration: inherit; - cursor: inherit; - &:active, &:focus { - outline: none; } } +@warn "This import is deprecated. Use 'compass/typography/links/unstyled-link' instead."; + +@import "../../typography/links/unstyled-link"; diff --git a/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.scss b/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.scss index aabe802a..796e1cd0 100644 --- a/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.scss +++ b/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.scss @@ -1,34 +1,3 @@ -// Turn off the bullet for an element of a list -@mixin no-bullet { - list-style-image : none; - list-style-type : none; - margin-left : 0px; -} +@warn "This import is deprecated. Use 'compass/typography/lists/bullets' instead."; -// turns off the bullets for an entire list -@mixin no-bullets { - list-style: none; - li { @include no-bullet; } -} - -// Make a list(ul/ol) have an image bullet. -// -// The mixin should be used like this for an icon that is 5x7: -// -// ul.pretty -// +pretty-bullets("my-icon.png", 5px, 7px) -// -// Additionally, if the image dimensions are not provided, -// The image dimensions will be extracted from the image itself. -// -// ul.pretty -// +pretty-bullets("my-icon.png") -// -@mixin pretty-bullets($bullet-icon, $width: image-width($bullet-icon), $height: image-height($bullet-icon), $line-height: 18px, $padding: 14px) { - margin-left: 0; - li { - padding-left: $padding; - background: image-url($bullet-icon) no-repeat ($padding - $width) / 2 ($line-height - $height) / 2; - list-style-type: none; - } -} +@import "../../typography/lists/bullets"; diff --git a/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss b/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss index 159b6599..38ae85cc 100644 --- a/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss +++ b/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss @@ -1,61 +1,3 @@ -// Horizontal list layout module. -// -// Easy mode using simple descendant li selectors: -// -// ul.nav -// +horizontal-list -// -// Advanced mode: -// If you need to target the list items using a different selector then use -// +horizontal-list-container on your ul/ol and +horizontal-list-item on your li. -// This may help when working on layouts involving nested lists. For example: -// -// ul.nav -// +horizontal-list-container -// > li -// +horizontal-list-item +@warn "This import is deprecated. Use 'compass/typography/lists/horizontal-list' instead."; -@import "bullets"; -@import "compass/utilities/general/clearfix"; -@import "compass/utilities/general/reset"; -@import "compass/utilities/general/float"; - -// Can be mixed into any selector that target a ul or ol that is meant -// to have a horizontal layout. Used to implement +horizontal-list. -@mixin horizontal-list-container { - @include reset-box-model; - @include clearfix; } - -// 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 -// -// IE8 ignores rules that are included on the same line as :last-child -// see http://www.richardscarrott.co.uk/posts/view/ie8-last-child-bug for details -// -// Setting `$padding` to `false` disables the padding between list elements -@mixin horizontal-list-item($padding: 4px, $direction: left) { - @include no-bullet; - white-space: nowrap; - @include float($direction); - @if $padding { - padding: { - left: $padding; - right: $padding; - } - &:first-child, &.first { padding-#{$direction}: 0; } - &:last-child { padding-#{opposite-position($direction)}: 0; } - &.last { padding-#{opposite-position($direction)}: 0; } - } -} - -// A list(ol,ul) that is layed out such that the elements are floated left and won't wrap. -// This is not an inline list. -// -// Setting `$padding` to `false` disables the padding between list elements -@mixin horizontal-list($padding: 4px, $direction: left) { - @include horizontal-list-container; - li { - @include horizontal-list-item($padding, $direction); } } +@import "../../typography/lists/horizontal-list"; diff --git a/frameworks/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss b/frameworks/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss index 907d443a..f669c85d 100644 --- a/frameworks/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss +++ b/frameworks/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss @@ -1,47 +1,3 @@ -// Inline-Block list layout module. -// -// Easy mode using simple descendant li selectors: -// -// ul.nav -// +inline-block-list -// -// Advanced mode: -// If you need to target the list items using a different selector then use -// +inline-block-list-container on your ul/ol and +inline-block-list-item on your li. -// This may help when working on layouts involving nested lists. For example: -// -// ul.nav -// +inline-block-list-container -// > li -// +inline-block-list-item +@warn "This import is deprecated. Use 'compass/typography/lists/inline-block-list' instead."; -@import "bullets"; -@import "horizontal-list"; -@import "compass/utilities/general/float"; -@import "compass/css3/inline-block"; - -// Can be mixed into any selector that target a ul or ol that is meant -// to have an inline-block layout. Used to implement +inline-block-list. -@mixin inline-block-list-container { - @include horizontal-list-container; } - -// Can be mixed into any li selector that is meant to participate in a horizontal layout. -// Used to implement +inline-block-list. - -@mixin inline-block-list-item($padding: false) { - @include no-bullet; - @include inline-block; - white-space: nowrap; - @if $padding { - padding: { - left: $padding; - right: $padding; - }; - } -} - -// A list(ol,ul) that is layed out such that the elements are inline-block and won't wrap. -@mixin inline-block-list($padding: false) { - @include inline-block-list-container; - li { - @include inline-block-list-item($padding); } } +@import "../../typography/lists/inline-block-link"; diff --git a/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss b/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss index 29bc74fc..fb1dfeb9 100644 --- a/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss +++ b/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss @@ -1,35 +1,3 @@ -// makes a list inline. +@warn "This import is deprecated. Use 'compass/typography/lists/inline-list' instead."; -@mixin inline-list { - list-style-type: none; - &, & li { - margin: 0px; - padding: 0px; - display: inline; - } -} - -// makes an inline list that is comma delimited. -// Please make note of the browser support issues before using this mixin. -// -// use of `content` and `:after` is not fully supported in all browsers. -// See quirksmode for the [support matrix](http://www.quirksmode.org/css/contents.html#t15) -// -// `:last-child` is not fully supported. -// see quirksmode for the [support matrix](http://www.quirksmode.org/css/contents.html#t29). -// -// IE8 ignores rules that are included on the same line as :last-child -// see http://www.richardscarrott.co.uk/posts/view/ie8-last-child-bug for details - -@mixin comma-delimited-list { - @include inline-list; - li { - &:after { content: ", "; } - &:last-child { - &:after { content: ""; } - } - &.last { - &:after { content: ""; } - } - } -} +@import "../../typography/lists/inline-list"; diff --git a/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss b/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss index bc749162..bc63081b 100644 --- a/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss +++ b/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss @@ -1,3 +1,6 @@ +// Determines those states for which you want to enable magic sprite selectors +$sprite-selectors: hover, target, active !default; + // Set the width and height of an element to the original // dimensions of an image before it was included in the sprite. @mixin sprite-dimensions($map, $sprite) { @@ -8,7 +11,7 @@ // Set the background position of the given sprite `$map` to display the // sprite of the given `$sprite` name. You can move the image relative to its // natural position by passing `$offset-x` and `$offset-y`. -@mixin sprite-position($map, $sprite, $offset-x: 0, $offset-y: 0) { +@mixin sprite-background-position($map, $sprite, $offset-x: 0, $offset-y: 0) { background-position: sprite-position($map, $sprite, $offset-x, $offset-y); } @@ -17,11 +20,30 @@ // class or you can specify the `sprite-url` explicitly like this: // // background: $map no-repeat; + +$disable-magic-sprite-selectors:false !default; + @mixin sprite($map, $sprite, $dimensions: false, $offset-x: 0, $offset-y: 0) { - @include sprite-position($map, $sprite, $offset-x, $offset-y); + @include sprite-background-position($map, $sprite, $offset-x, $offset-y); @if $dimensions { @include sprite-dimensions($map, $sprite); } + @if not $disable-magic-sprite-selectors { + @include sprite-selectors($map, $sprite, $sprite); + } +} + +// Include the selectors for the `$sprite` given the `$map` and the +// `$full-sprite-name` +// @private +@mixin sprite-selectors($map, $sprite-name, $full-sprite-name) { + @each $selector in $sprite-selectors { + @if sprite_has_selector($map, $sprite-name, $selector) { + &:#{$selector}, &.#{$full-sprite-name}_#{$selector}, &.#{$full-sprite-name}-#{$selector} { + @include sprite-background-position($map, "#{$sprite-name}_#{$selector}"); + } + } + } } // Generates a class for each space separated name in `$sprite-names`. @@ -32,10 +54,12 @@ // If `$dimensions` is `true`, the sprite dimensions will specified. @mixin sprites($map, $sprite-names, $base-class: false, $dimensions: false, $prefix: sprite-map-name($map)) { @each $sprite-name in $sprite-names { - $full-sprite-name: if($prefix and $prefix != "", "#{$prefix}-#{$sprite-name}", $sprite-name); - .#{$full-sprite-name} { - @if $base-class { @extend #{$base-class}; } - @include sprite($map, $sprite-name, $dimensions); + @if sprite_does_not_have_parent($map, $sprite-name) { + $full-sprite-name: "#{$prefix}-#{$sprite-name}"; + .#{$full-sprite-name} { + @if $base-class { @extend #{$base-class}; } + @include sprite($map, $sprite-name, $dimensions); + } } } } \ No newline at end of file diff --git a/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.scss b/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.scss index 3b3db25d..b1727547 100644 --- a/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.scss +++ b/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.scss @@ -1,25 +1,3 @@ -@import "compass/css3/shared"; +@warn "This import is deprecated. Use 'compass/typography/text/ellipsis' instead."; -// To get full firefox support, you must install the ellipsis pattern: -// -// compass install compass/ellipsis -$use-mozilla-ellipsis-binding: false !default; - -// This technique, by [Justin Maxwell](http://code404.com/), was originally -// published [here](http://mattsnider.com/css/css-string-truncation-with-ellipsis/). -// Firefox implementation by [Rikkert Koppes](http://www.rikkertkoppes.com/thoughts/2008/6/). -@mixin ellipsis($no-wrap: true) { - @if $no-wrap { white-space: nowrap; } - overflow: hidden; - @include experimental(text-overflow, ellipsis, - not -moz, - not -webkit, - -o, - -ms, - not -khtml, - official - ); - @if $experimental-support-for-mozilla and $use-mozilla-ellipsis-binding { - -moz-binding: stylesheet-url(unquote("xml/ellipsis.xml#ellipsis")); - } -} +@import "../../typography/text/ellipsis"; diff --git a/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.scss b/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.scss index 1613dd67..ca4a22f9 100644 --- a/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.scss +++ b/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.scss @@ -1,2 +1,3 @@ -// When remembering whether or not there's a hyphen in white-space is too hard -@mixin nowrap { white-space: nowrap; } +@warn "This import is deprecated. Use 'compass/typography/text/nowrap' instead."; + +@import "../../typography/text/nowrap"; diff --git a/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss b/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss index 041f1053..809c6a8b 100644 --- a/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss +++ b/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss @@ -1,34 +1,3 @@ -// Hides html text and replaces it with an image. -// If you use this on an inline element, you will need to change the display to block or inline-block. -// Also, if the size of the image differs significantly from the font size, you'll need to set the width and/or height. -// -// Parameters: -// -// * `img` -- the relative path from the project image directory to the image. -// * `x` -- the x position of the background image. -// * `y` -- the y position of the background image. -@mixin replace-text($img, $x: 50%, $y: 50%) { - @include hide-text; - background: { - image: image-url($img); - repeat: no-repeat; - position: $x $y; - }; -} +@warn "This import is deprecated. Use 'compass/typography/text/replacement' instead."; -// Like the `replace-text` mixin, but also sets the width -// and height of the element according the dimensions of the image. -@mixin replace-text-with-dimensions($img, $x: 50%, $y: 50%) { - @include replace-text($img, $x, $y); - width: image-width($img); - height: image-height($img); -} - -// Hides text in an element so you can see the background. -@mixin hide-text { - $approximate_em_value: 12px / 1em; - $wider_than_any_screen: -9999em; - text-indent: $wider_than_any_screen * $approximate_em_value; - overflow: hidden; - text-align: left; -} +@import "../../typography/text/replacement"; diff --git a/frameworks/compass/templates/ellipsis/ellipsis.sass b/frameworks/compass/templates/ellipsis/ellipsis.sass index 6285df65..55837ca9 100644 --- a/frameworks/compass/templates/ellipsis/ellipsis.sass +++ b/frameworks/compass/templates/ellipsis/ellipsis.sass @@ -1,7 +1,7 @@ // Since you've installed the xml file, you should set // $use-mozilla-ellipsis-binding to true before importing. $use-mozilla-ellipsis-binding: true -@import compass/utilities/text/ellipsis +@import compass/typography/text/ellipsis // You can delete this sass file if you want, it's just an example of how to use the ellipsis mixin. // By default, ellipsis text is no-wrap. Pass false as the first argument if you don't want that. diff --git a/frameworks/compass/templates/extension/manifest.rb b/frameworks/compass/templates/extension/manifest.rb index 4a6588da..96fc235c 100644 --- a/frameworks/compass/templates/extension/manifest.rb +++ b/frameworks/compass/templates/extension/manifest.rb @@ -1,8 +1,14 @@ description "Generate a compass extension." -file 'stylesheets/main.sass', :to => "stylesheets/_#{File.basename(options[:pattern_name]||options[:project_name]||'main')}.sass" +unless options.include?(:preferred_syntax) + options[:preferred_syntax] = 'sass' +end + file 'templates/project/manifest.rb' -file 'templates/project/screen.sass' +file "stylesheets/main.sass", :to => "stylesheets/_#{File.basename(options[:pattern_name]||options[:project_name]||'main')}.#{options[:preferred_syntax]}" + +file "templates/project/screen.sass", :to => "templates/project/screen.#{options[:preferred_syntax]}" + help %Q{ To generate a compass extension: diff --git a/frameworks/compass/templates/pie/manifest.rb b/frameworks/compass/templates/pie/manifest.rb index 1348c079..a4e9de03 100644 --- a/frameworks/compass/templates/pie/manifest.rb +++ b/frameworks/compass/templates/pie/manifest.rb @@ -1,4 +1,4 @@ -description "Plugin for cross-browser ellipsis truncated text." +description "Integration with http://css3pie.com/" file 'PIE.htc', :like => :css stylesheet 'pie.scss', :erb => true diff --git a/lib/compass.rb b/lib/compass.rb index 2f0b7ec7..dd1116b7 100644 --- a/lib/compass.rb +++ b/lib/compass.rb @@ -1,10 +1,12 @@ module Compass end -%w(dependencies util browser_support sass_extensions core_ext version errors quick_cache).each do |lib| +%w(dependencies util browser_support sass_extensions version errors quick_cache).each do |lib| require "compass/#{lib}" end +require 'sass/callbacks' + module Compass def base_directory File.expand_path(File.join(File.dirname(__FILE__), '..')) @@ -12,10 +14,13 @@ module Compass def lib_directory File.expand_path(File.join(File.dirname(__FILE__))) end - module_function :base_directory, :lib_directory + def shared_extension_paths + [File.expand_path("~/.compass/extensions")] + end + module_function :base_directory, :lib_directory, :shared_extension_paths extend QuickCache end -%w(configuration frameworks app_integration actions compiler sprites).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 cbd48b99..06bc7764 100644 --- a/lib/compass/app_integration/rails.rb +++ b/lib/compass/app_integration/rails.rb @@ -11,6 +11,14 @@ module Compass extend self + def booted! + Compass::AppIntegration::Rails.const_set(:BOOTED, true) + end + + def booted? + defined?(Compass::AppIntegration::Rails::BOOTED) && Compass::AppIntegration::Rails::BOOTED + end + def installer(*args) Installer.new(*args) end @@ -21,13 +29,19 @@ module Compass end def env - if rails_env = (defined?(::Rails) ? ::Rails.env : (defined?(RAILS_ENV) ? RAILS_ENV : nil)) - rails_env.production? ? :production : :development + env_production? ? :production : :development + end + + def env_production? + if defined?(::Rails) && ::Rails.respond_to?(:env) + ::Rails.env.production? + elsif defined?(RAILS_ENV) + RAILS_ENV == "production" end end def root - if defined?(::Rails) + if defined?(::Rails) && ::Rails.respond_to?(:root) ::Rails.root elsif defined?(RAILS_ROOT) RAILS_ROOT @@ -35,6 +49,11 @@ module Compass end def initialize!(config = nil) + if booted? + Compass::Util.compass_warn("Warning: Compass was booted twice. Compass has a Railtie now; please remove your intializer.") + else + booted! + end config ||= Compass.detect_configuration_file(root) Compass.add_project_configuration(config, :project_type => :rails) Compass.discover_extensions! diff --git a/lib/compass/app_integration/rails/installer.rb b/lib/compass/app_integration/rails/installer.rb index 536d6975..e4f3db92 100644 --- a/lib/compass/app_integration/rails/installer.rb +++ b/lib/compass/app_integration/rails/installer.rb @@ -163,7 +163,7 @@ NEXTSTEPS manifest.each_stylesheet do |stylesheet| # Skip partials. next if File.basename(stylesheet.from)[0..0] == "_" - ss_line = "<%= stylesheet_link_tag '#{stylesheet_prefix}#{stylesheet.to.sub(/\.sass$/,'.css')}'" + ss_line = "<%= stylesheet_link_tag '#{stylesheet_prefix}#{stylesheet.to.sub(/\.s[ac]ss$/,'.css')}'" if stylesheet.options[:media] ss_line += ", :media => '#{stylesheet.options[:media]}'" end diff --git a/lib/compass/app_integration/rails/templates/compass-install-rails.rb b/lib/compass/app_integration/rails/templates/compass-install-rails.rb index 8bbc5593..aa2b8ce8 100644 --- a/lib/compass/app_integration/rails/templates/compass-install-rails.rb +++ b/lib/compass/app_integration/rails/templates/compass-install-rails.rb @@ -47,18 +47,18 @@ css_framework = ask("What CSS Framework install do you want to use with Compass? # sass storage prompt sass_dir = ask("Where would you like to keep your sass files within your project? (default: 'app/stylesheets')") -sass_dir = "app/stylesheets" if sass_dir.blank? +sass_dir = "app/stylesheets" if Compass::Util.blank?(sass_dir) # compiled css storage prompt css_dir = ask("Where would you like Compass to store your compiled css files? (default: 'public/stylesheets/compiled')") -css_dir = "public/stylesheets/compiled" if css_dir.blank? +css_dir = "public/stylesheets/compiled" if Compass::Util.blank?(css_dir) # use sudo for gem commands? use_sudo = nil if sudo_is_an_option? # dont give them the option if they are on a system that can't use sudo (aka windows) use_sudo = yes?("Use sudo for the gem commands? (the default for your system is #{sudo_is_an_option? ? 'yes' : 'no'})") end -use_sudo = sudo_is_an_option? if use_sudo.blank? +use_sudo = sudo_is_an_option? if Compass::Util.blank?(use_sudo) # define dependencies gem "haml", :version => ">=3.0.0" @@ -71,7 +71,7 @@ rake "gems:unpack GEM=compass --trace" # build out compass command compass_command = "compass init rails . --css-dir=#{css_dir} --sass-dir=#{sass_dir} " -compass_command << "--using #{css_framework} " unless css_framework.blank? +compass_command << "--using #{css_framework} " unless Compass::Util.blank?(css_framework) # integrate it! run "haml --rails ." diff --git a/lib/compass/commands/generate_grid_background.rb b/lib/compass/commands/generate_grid_background.rb index 426fbc1e..b8a06e35 100644 --- a/lib/compass/commands/generate_grid_background.rb +++ b/lib/compass/commands/generate_grid_background.rb @@ -16,7 +16,10 @@ Description: By default, the image generated will be named "grid.png" and be found in the images directory. - This command requires that you have both ImageMagick and RMagick installed. + Unless you need to check layouts in legacy browsers, it's preferable + to use the pure CSS3-based grid background mixin: + + http://compass-style.org/reference/compass/layout/grid_background/ Examples: @@ -76,6 +79,12 @@ Options: puts "where 30 is the column width, 10 is the gutter width, and 20 is the (optional) height." return end + logger.yellow do + $stderr.puts "Unless you need to check layouts in legacy browsers, it's preferable" + $stderr.puts "to use the pure CSS3-based grid background mixin:" + $stderr.puts + $stderr.puts "http://compass-style.org/reference/compass/layout/grid_background/" + end column_width = $1.to_i gutter_width = $2.to_i height = $3.to_i if $3 diff --git a/lib/compass/commands/print_version.rb b/lib/compass/commands/print_version.rb index bc6fa059..449964b5 100644 --- a/lib/compass/commands/print_version.rb +++ b/lib/compass/commands/print_version.rb @@ -54,6 +54,18 @@ Options: parser.parse! parser.options end + def long_output_string + lines = [] + lines << "Compass #{::Compass.version[:string]}" + if name = ::Compass.version[:name] + lines.last << " (#{name})" + end + lines << "Copyright (c) 2008-#{Time.now.year} Chris Eppstein" + lines << "Released under the MIT License." + lines << "Compass is charityware." + lines << "Please make a tax deductable donation for a worthy cause: http://umdf.org/compass" + lines.join("\n") + end end attr_accessor :options @@ -79,13 +91,7 @@ Options: elsif options[:quiet] puts ::Compass.version[:string] else - lines = [] - lines << "Compass #{::Compass.version[:string]}" - lines << "Copyright (c) 2008-#{Time.now.year} Chris Eppstein" - lines << "Released under the MIT License." - lines << "Compass is charityware." - lines << "Please make a tax deductable donation: http://umdf.org/compass" - puts lines.join("\n") + puts self.class.long_output_string end end end diff --git a/lib/compass/commands/sprite.rb b/lib/compass/commands/sprite.rb index 545cf19e..2b33f9fc 100644 --- a/lib/compass/commands/sprite.rb +++ b/lib/compass/commands/sprite.rb @@ -8,6 +8,9 @@ module Compass opts.on("-f SPRITE_FILE") do |output_file| self.options[:output_file] = output_file end + opts.on("--skip-overrides", "Skip the generation of sprite overrides") do |skip_overrides| + self.options[:skip_overrides] = skip_overrides + end opts.banner = %Q{ Usage: compass sprite [options] "images/path/to/sprites/*.png" @@ -35,13 +38,11 @@ module Compass end def perform - sprites = Compass::Sprites.new relative_uri = options[:uri].gsub(/^#{Compass.configuration.images_dir}\//, '') - sprite_images = Compass::Sprites.discover_sprites(relative_uri) - image_names = sprite_images.map{|i| File.basename(i, '.png')} - sprites.path, sprites.name = Compass::Sprites.path_and_name(relative_uri) + sprites = Compass::SpriteMap.new(relative_uri, Compass.sass_engine_options) options[:output_file] ||= File.join(Compass.configuration.sass_path, "sprites", "_#{sprites.name}.#{Compass.configuration.preferred_syntax}") - contents = sprites.content_for_images(relative_uri, sprites.name, image_names) + options[:skip_overrides] ||= false + contents = sprites.content_for_images(options[:skip_overrides]) if options[:output_file][-4..-1] != "scss" contents = Sass::Engine.new(contents, Compass.sass_engine_options.merge(:syntax => :scss)).to_tree.to_sass end diff --git a/lib/compass/commands/update_project.rb b/lib/compass/commands/update_project.rb index 7ce101f2..b98fa93a 100644 --- a/lib/compass/commands/update_project.rb +++ b/lib/compass/commands/update_project.rb @@ -49,17 +49,28 @@ module Compass end def new_compiler_instance(additional_options = {}) - compiler_opts = Compass.sass_engine_options - compiler_opts.merge!(:force => options[:force], - :sass_files => explicit_sass_files, - :dry_run => options[:dry_run]) - compiler_opts[:quiet] = options[:quiet] if options[:quiet] - compiler_opts[:time] = options[:time] if options[:time] - compiler_opts.merge!(additional_options) - Compass::Compiler.new(working_path, + @compiler_opts ||= begin + compiler_opts = Compass.sass_engine_options + compiler_opts.merge!(:force => options[:force], + :sass_files => explicit_sass_files, + :dry_run => options[:dry_run]) + compiler_opts[:quiet] = options[:quiet] if options[:quiet] + compiler_opts[:time] = options[:time] if options[:time] + compiler_opts + end + + @memory_store ||= Sass::CacheStores::Memory.new + @backing_store ||= compiler_opts[:cache_store] + @backing_store ||= Sass::CacheStores::Filesystem.new(determine_cache_location) + @cache_store ||= Sass::CacheStores::Chain.new(@memory_store, @backing_store) + @memory_store.reset! + + Compass::Compiler.new( + working_path, Compass.configuration.sass_path, Compass.configuration.css_path, - compiler_opts) + @compiler_opts.merge(:cache_store => @cache_store).merge(additional_options) + ) end def explicit_sass_files @@ -73,6 +84,9 @@ module Compass end end + def determine_cache_location + Compass.configuration.cache_path || Sass::Plugin.options[:cache_location] || File.join(working_path, ".sass-cache") + end class << self def option_parser(arguments) diff --git a/lib/compass/commands/watch_project.rb b/lib/compass/commands/watch_project.rb index 3d35023a..cdc2bf2f 100644 --- a/lib/compass/commands/watch_project.rb +++ b/lib/compass/commands/watch_project.rb @@ -2,6 +2,7 @@ require 'fileutils' require 'pathname' require 'compass/commands/base' require 'compass/commands/update_project' +require 'sass/plugin' module Compass module Commands @@ -24,12 +25,39 @@ module Compass end end + module MemoryDebugger + def report_on_instances(type, options = {}) + @@runs ||= 0 + @@runs += 1 + @@object_id_tracker ||= {} + @@object_id_tracker[type] ||= [] + GC.start + sleep options.fetch(:gc_pause, 1) + count = ObjectSpace.each_object(type) do |obj| + if options.fetch(:verbose, true) + if @@runs > 2 + if !@@object_id_tracker[type].include?(obj.object_id) + begin + puts obj.inspect + rescue + end + puts "#{obj.class.name}:#{obj.object_id}" + end + end + @@object_id_tracker[type] << obj.object_id + end + end + puts "#{type}: #{count} instances." + end + end class WatchProject < UpdateProject register :watch attr_accessor :last_update_time, :last_sass_files + include MemoryDebugger + def perform Signal.trap("INT") do puts "" @@ -39,12 +67,8 @@ module Compass check_for_sass_files!(new_compiler_instance) recompile - begin - require 'fssm' - rescue LoadError - $: << File.join(Compass.lib_directory, 'vendor', 'fssm') - retry - end + require 'fssm' + if options[:poll] require "fssm/backends/polling" @@ -58,8 +82,10 @@ module Compass puts ">>> Compass is #{action} for changes. Press Ctrl-C to Stop." + begin FSSM.monitor do |monitor| Compass.configuration.sass_load_paths.each do |load_path| + load_path = load_path.root if load_path.respond_to?(:root) next unless load_path.is_a? String monitor.path load_path do |path| path.glob '**/*.s[ac]ss' @@ -88,7 +114,12 @@ module Compass end end - + rescue FSSM::CallbackError => e + # FSSM catches exit? WTF. + if e.message =~ /exit/ + exit + end + end end def remove_obsolete_css(base = nil, relative = nil) @@ -103,11 +134,13 @@ module Compass end def recompile(base = nil, relative = nil) + @memory_cache.reset! if @memory_cache compiler = new_compiler_instance(:quiet => true) if file = compiler.out_of_date? begin - puts ">>> Change detected to: #{file}" + puts ">>> Change detected to: #{relative || compiler.relative_stylesheet_name(file)}" compiler.run + GC.start rescue StandardError => e ::Compass::Exec::Helpers.report_error(e, options) end diff --git a/lib/compass/compiler.rb b/lib/compass/compiler.rb index b259dfce..0f4f70f9 100644 --- a/lib/compass/compiler.rb +++ b/lib/compass/compiler.rb @@ -3,15 +3,16 @@ module Compass include Actions - attr_accessor :working_path, :from, :to, :options + attr_accessor :working_path, :from, :to, :options, :staleness_checker, :importer def initialize(working_path, from, to, options) self.working_path = working_path - self.from, self.to = from, to + self.from, self.to = from.gsub('./', ''), to self.logger = options.delete(:logger) self.options = options self.options[:cache_location] ||= determine_cache_location - Compass.configure_sass_plugin! + options[:importer] = self.importer = Sass::Importers::Filesystem.new(from) + self.staleness_checker = Sass::Plugin::StalenessChecker.new(options) end def determine_cache_location @@ -23,8 +24,16 @@ module Compass @sass_files = self.options[:sass_files] || Dir.glob(separate("#{from}/**/#{'[^_]' if exclude_partials}*.s[ac]ss")) end + def relative_stylesheet_name(sass_file) + sass_file[(from.length + 1)..-1] + end + def stylesheet_name(sass_file) - sass_file[("#{from}/".length)..-6] + if sass_file.index(from) == 0 + sass_file[(from.length + 1)..-6] + else + raise Compass::Error, "You must compile individual stylesheets from the project directory." + end end def css_files @@ -42,11 +51,15 @@ module Compass # Returns the sass file that needs to be compiled, if any. def out_of_date? sass_files.zip(css_files).each do |sass_filename, css_filename| - return sass_filename if Sass::Plugin.send(:stylesheet_needs_update?, css_filename, sass_filename) + return sass_filename if needs_update?(css_filename, sass_filename) end false end + def needs_update?(css_filename, sass_filename) + staleness_checker.stylesheet_needs_update?(css_filename, File.expand_path(sass_filename), importer) + end + # Determines if the configuration file is newer than any css file def new_config? config_file = Compass.detect_configuration_file @@ -92,7 +105,7 @@ module Compass def compile_if_required(sass_filename, css_filename) if should_compile?(sass_filename, css_filename) - compile sass_filename, css_filename, :time => options[:time] + compile sass_filename, css_filename else logger.record :unchanged, basename(sass_filename) unless options[:quiet] end @@ -110,19 +123,20 @@ module Compass end # Compile one Sass file - def compile(sass_filename, css_filename, additional_options = {}) + def compile(sass_filename, css_filename) start_time = end_time = nil css_content = logger.red do timed do engine(sass_filename, css_filename).render end end - duration = additional_options[:time] ? "(#{(css_content.__duration * 1000).round / 1000.0}s)" : "" + duration = options[:time] ? "(#{(css_content.__duration * 1000).round / 1000.0}s)" : "" write_file(css_filename, css_content, options.merge(:force => true, :extra => duration)) + Compass.configuration.run_callback(:stylesheet_saved, css_filename) end def should_compile?(sass_filename, css_filename) - options[:force] || Sass::Plugin.send(:stylesheet_needs_update?, css_filename, sass_filename) + options[:force] || needs_update?(css_filename, sass_filename) end # A sass engine for compiling a single file. @@ -136,7 +150,10 @@ module Compass # formatted to display in the browser (in development mode) # if there's an error. def handle_exception(sass_filename, css_filename, e) - logger.record :error, basename(sass_filename), "(Line #{e.sass_line}: #{e.message})" + formatted_error = "(Line #{e.sass_line}: #{e.message})" + file = basename(sass_filename) + logger.record :error, file, formatted_error + Compass.configuration.run_callback(:styesheet_error, sass_filename, formatted_error) write_file css_filename, error_contents(e, sass_filename), options.merge(:force => true) end diff --git a/lib/compass/configuration.rb b/lib/compass/configuration.rb index c51e9a88..2990e85d 100644 --- a/lib/compass/configuration.rb +++ b/lib/compass/configuration.rb @@ -37,12 +37,47 @@ module Compass :line_comments, :color_output, :preferred_syntax, - :disable_warnings + :disable_warnings, + :sprite_engine ].flatten + # Registers a new configuration property. + # Extensions can use this to add new configuration options to compass. + # + # @param [Symbol] name The name of the property. + # @param [String] comment A comment for the property. + # @param [Proc] default A method to calculate the default value for the property. + # The proc is executed in the context of the project's configuration data. + def self.add_configuration_property(name, comment = nil, &default) + ATTRIBUTES << name + if comment.is_a?(String) + unless comment[0..0] == "#" + comment = "# #{comment}" + end + unless comment[-1..-1] == "\n" + comment = comment + "\n" + end + Data.class_eval <<-COMMENT + def comment_for_#{name} + #{comment.inspect} + end + COMMENT + end + Data.send(:define_method, :"default_#{name}", &default) if default + Data.inherited_accessor(name) + if name.to_s =~ /dir|path/ + strip_trailing_separator(name) + end + end + + # For testing purposes + def self.remove_configuration_property(name) + ATTRIBUTES.delete(name) + end + end end -['adapters', 'comments', 'defaults', 'helpers', 'inheritance', 'serialization', 'paths', 'data'].each do |lib| +['adapters', 'comments', 'defaults', 'helpers', 'inheritance', 'serialization', 'paths', 'data', 'file_data'].each do |lib| require "compass/configuration/#{lib}" end diff --git a/lib/compass/configuration/adapters.rb b/lib/compass/configuration/adapters.rb index 3ae9149b..9897f321 100644 --- a/lib/compass/configuration/adapters.rb +++ b/lib/compass/configuration/adapters.rb @@ -55,10 +55,14 @@ module Compass def sass_load_paths load_paths = [] load_paths << sass_path if sass_path - Compass::Frameworks::ALL.each do |framework| - load_paths << framework.stylesheets_directory if File.exists?(framework.stylesheets_directory) + Compass::Frameworks::ALL.each do |f| + load_paths << f.stylesheets_directory if File.directory?(f.stylesheets_directory) end load_paths += resolve_additional_import_paths + load_paths.map! do |p| + next p if p.respond_to?(:find_relative) + Sass::Importers::Filesystem.new(p.to_s) + end load_paths << Compass::Sprites.new load_paths end diff --git a/lib/compass/configuration/data.rb b/lib/compass/configuration/data.rb index 91dec02a..9cde724d 100644 --- a/lib/compass/configuration/data.rb +++ b/lib/compass/configuration/data.rb @@ -125,6 +125,7 @@ module Compass Compass::Frameworks.register_directory framework_dir end + # Finds all extensions within a directory and registers them. def discover(frameworks_dir) (self.framework_path ||= []) << frameworks_dir Compass::Frameworks.discover frameworks_dir @@ -135,6 +136,16 @@ module Compass relative_assets || http_images_path == :relative end + def run_callback(event, *args) + begin + send(:"run_#{event}", *args) + rescue NoMethodError => e + unless e.message =~ /run_#{event}/ + raise + end + end + end + private def assert_valid_keys!(attr_hash) diff --git a/lib/compass/configuration/defaults.rb b/lib/compass/configuration/defaults.rb index db63bd3e..7c9add32 100644 --- a/lib/compass/configuration/defaults.rb +++ b/lib/compass/configuration/defaults.rb @@ -30,7 +30,7 @@ module Compass if top_level.environment == :development :expanded else - :compact + :compressed end end @@ -128,6 +128,11 @@ module Compass def default_preferred_syntax :scss end + + def default_sprite_engine + :chunky_png + end + # helper functions def http_join(*segments) diff --git a/lib/compass/configuration/file_data.rb b/lib/compass/configuration/file_data.rb new file mode 100644 index 00000000..af628752 --- /dev/null +++ b/lib/compass/configuration/file_data.rb @@ -0,0 +1,43 @@ +module Compass + module Configuration + class FileData < Data + extend Sass::Callbacks + + # on_sprite_generated + # yields the filename + # usage: on_sprite_save {|filename| do_somethign(filename) } + define_callback :sprite_saved + + # on_sprite_generated + # yields 'ChunkyPNG::Image' + # usage: on_sprite_generated {|sprite_data| do_something(sprite_data) } + define_callback :sprite_generated + + # on_stylesheet_saved + # yields the filename + # usage: on_stylesheet_saved {|filename| do_something(filename) } + define_callback :stylesheet_saved + + # on_stylesheet_error + # yields the filename & message + # usage: on_stylesheet_error {|filename, message| do_something(filename, message) } + define_callback :stylesheet_error + + def self.new_from_file(config_file, defaults = nil) + data = new(config_file) + data.with_defaults(defaults) do + data._parse(config_file) + end + data + end + + def self.new_from_string(contents, filename, defaults = nil) + data = new(filename) + data.with_defaults(defaults) do + data.parse_string(contents, filename) + end + data + end + end + end +end diff --git a/lib/compass/configuration/helpers.rb b/lib/compass/configuration/helpers.rb index 2f037d8a..db6f8af6 100644 --- a/lib/compass/configuration/helpers.rb +++ b/lib/compass/configuration/helpers.rb @@ -1,5 +1,6 @@ module Compass module Configuration + @callbacks_loaded = false # The helpers are available as methods on the Compass module. E.g. Compass.configuration module Helpers def configuration @@ -34,11 +35,11 @@ module Compass config elsif config.respond_to?(:read) filename ||= config.to_s if config.is_a?(Pathname) - Compass::Configuration::Data.new_from_string(config.read, filename, defaults) + Compass::Configuration::FileData.new_from_string(config.read, filename, defaults) elsif config.is_a?(Hash) Compass::Configuration::Data.new(filename, config) elsif config.is_a?(String) - Compass::Configuration::Data.new_from_file(config, defaults) + Compass::Configuration::FileData.new_from_file(config, defaults) elsif config.is_a?(Symbol) Compass::AppIntegration.lookup(config).configuration else @@ -65,6 +66,15 @@ module Compass Sass::Plugin.add_template_location sass_dir, css_dir end end + unless @callbacks_loaded + Sass::Plugin.on_updating_stylesheet do |sass_file, css_file| + Compass.configuration.run_callback(:stylesheet_saved, css_file) + end + Sass::Plugin.on_compilation_error do |e, filename, css| + Compass.configuration.run_callback(:stylesheet_error, filename, e.message) + end + @callbacks_loaded = true + end end def sass_engine_options @@ -92,7 +102,12 @@ module Compass end def discover_extensions! - if File.exists?(configuration.extensions_path) + Compass.shared_extension_paths.each do |extensions_path| + if File.directory?(extensions_path) + Compass::Frameworks.discover(extensions_path) + end + end + if File.directory?(configuration.extensions_path) Compass::Frameworks.discover(configuration.extensions_path) end end diff --git a/lib/compass/configuration/inheritance.rb b/lib/compass/configuration/inheritance.rb index b44954ca..da12b5bc 100644 --- a/lib/compass/configuration/inheritance.rb +++ b/lib/compass/configuration/inheritance.rb @@ -141,9 +141,9 @@ module Compass end end - def method_missing(meth) + def method_missing(meth, *args, &block) if inherited_data - inherited_data.send(meth) + inherited_data.send(meth, *args, &block) else raise NoMethodError, meth.to_s end diff --git a/lib/compass/configuration/serialization.rb b/lib/compass/configuration/serialization.rb index afdf4fc5..ff41ecc2 100644 --- a/lib/compass/configuration/serialization.rb +++ b/lib/compass/configuration/serialization.rb @@ -2,100 +2,76 @@ module Compass module Configuration # The serialization module manages reading and writing the configuration file(s). module Serialization - def self.included(base) - base.send(:include, InstanceMethods) - base.extend ClassMethods + def parse(config_file) + raise Compass::Error, "Compass.configuration.parse(filename) has been removed. Please call Compass.add_project_configuration(filename) instead." end - module ClassMethods - def new_from_file(config_file, defaults = nil) - data = Data.new(config_file) - data.with_defaults(defaults) do - data._parse(config_file) - end - data + # 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 - - def new_from_string(contents, filename, defaults = nil) - data = Data.new(filename) - data.with_defaults(defaults) do - data.parse_string(contents, filename) - end - data + open(config_file) do |f| + parse_string(f.read, config_file) end end - module InstanceMethods - def parse(config_file) - raise Compass::Error, "Compass.configuration.parse(filename) has been removed. Please call Compass.add_project_configuration(filename) instead." + def parse_string(contents, filename) + bind = binding + 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 - - # 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 - open(config_file) do |f| - parse_string(f.read, config_file) - end + if @added_import_paths + self.additional_import_paths ||= [] + self.additional_import_paths += @added_import_paths end - - def parse_string(contents, filename) - bind = binding - 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 - self.additional_import_paths ||= [] - self.additional_import_paths += @added_import_paths - end - issue_deprecation_warnings - end - - def serialize - contents = "" - (required_libraries || []).each do |lib| - contents << %Q{require '#{lib}'\n} - end - (loaded_frameworks || []).each do |lib| - contents << %Q{load '#{lib}'\n} - end - (framework_path || []).each do |lib| - contents << %Q{discover '#{lib}'\n} - end - contents << "# Require any additional compass plugins here.\n" - contents << "\n" if (required_libraries || []).any? - ATTRIBUTES.each do |prop| - value = send("#{prop}_without_default") - if value.is_a?(Proc) - $stderr.puts "WARNING: #{prop} is code and cannot be written to a file. You'll need to copy it yourself." - end - if respond_to?("comment_for_#{prop}") - contents << send("comment_for_#{prop}") - end - if block_given? && (to_emit = yield(prop, value)) - contents << to_emit - else - contents << serialize_property(prop, value) unless value.nil? - end - end - contents - end - - 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." - end - end - + issue_deprecation_warnings end + + def serialize + contents = "" + (required_libraries || []).each do |lib| + contents << %Q{require '#{lib}'\n} + end + (loaded_frameworks || []).each do |lib| + contents << %Q{load '#{lib}'\n} + end + (framework_path || []).each do |lib| + contents << %Q{discover '#{lib}'\n} + end + contents << "# Require any additional compass plugins here.\n" + contents << "\n" if (required_libraries || []).any? + ATTRIBUTES.each do |prop| + value = send("#{prop}_without_default") + if value.is_a?(Proc) + $stderr.puts "WARNING: #{prop} is code and cannot be written to a file. You'll need to copy it yourself." + end + if respond_to?("comment_for_#{prop}") + contents << "\n" + contents << send("comment_for_#{prop}") + end + if block_given? && (to_emit = yield(prop, value)) + contents << to_emit + else + contents << serialize_property(prop, value) unless value.nil? + end + end + contents + end + + 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." + end + end + end end end diff --git a/lib/compass/core_ext.rb b/lib/compass/core_ext.rb deleted file mode 100644 index 09927e72..00000000 --- a/lib/compass/core_ext.rb +++ /dev/null @@ -1,14 +0,0 @@ -class String - unless method_defined?(:blank?) - # see if string has any content - def blank?; self.length.zero?; end - end -end - -class NilClass - unless method_defined?(:blank?) - def blank? - true - end - end -end diff --git a/lib/compass/exec/project_options_parser.rb b/lib/compass/exec/project_options_parser.rb index e7fbfc54..fa3052ff 100644 --- a/lib/compass/exec/project_options_parser.rb +++ b/lib/compass/exec/project_options_parser.rb @@ -37,14 +37,14 @@ module Compass::Exec::ProjectOptionsParser end opts.on('-e ENV', '--environment ENV', [:development, :production], 'Use sensible defaults for your current environment.', - ' One of: development, production (default)') do |env| + ' One of: development (default), production') do |env| self.options[:environment] = env - end + end opts.on('-s STYLE', '--output-style STYLE', [:nested, :expanded, :compact, :compressed], 'Select a CSS output mode.', ' One of: nested, expanded, compact, compressed') do |style| self.options[:output_style] = style - end + end opts.on('--relative-assets', :NONE, 'Make compass asset helpers generate relative urls to assets.') do self.options[:relative_assets] = true diff --git a/lib/compass/installers/manifest_installer.rb b/lib/compass/installers/manifest_installer.rb index 04e1d909..48a10705 100644 --- a/lib/compass/installers/manifest_installer.rb +++ b/lib/compass/installers/manifest_installer.rb @@ -48,7 +48,7 @@ module Compass media = if stylesheet.options[:media] %Q{ media="#{stylesheet.options[:media]}"} end - ss_line = %Q{ } + ss_line = %Q{ } if stylesheet.options[:condition] ss_line = " " end diff --git a/lib/compass/logger.rb b/lib/compass/logger.rb index e1be0f55..760c4867 100644 --- a/lib/compass/logger.rb +++ b/lib/compass/logger.rb @@ -48,6 +48,15 @@ module Compass $stdout.write(color(:clear)) end + def yellow + $stderr.write(color(:yellow)) + $stdout.write(color(:yellow)) + yield + ensure + $stderr.write(color(:clear)) + $stdout.write(color(:clear)) + end + def color(c) if Compass.configuration.color_output && c && COLORS.has_key?(c.to_sym) if defined?($boring) && $boring diff --git a/lib/compass/sass_extensions.rb b/lib/compass/sass_extensions.rb index 182717b1..0b89610d 100644 --- a/lib/compass/sass_extensions.rb +++ b/lib/compass/sass_extensions.rb @@ -3,3 +3,4 @@ end require 'compass/sass_extensions/functions' require 'compass/sass_extensions/monkey_patches' +require 'compass/sass_extensions/sprites' diff --git a/lib/compass/sass_extensions/functions/colors.rb b/lib/compass/sass_extensions/functions/colors.rb index 70be6162..999012ce 100644 --- a/lib/compass/sass_extensions/functions/colors.rb +++ b/lib/compass/sass_extensions/functions/colors.rb @@ -40,7 +40,7 @@ module Compass::SassExtensions::Functions::Colors alphastr = alpha.to_s(16).rjust(2, '0') Sass::Script::String.new("##{alphastr}#{color.send(:hex_str)[1..-1]}".upcase) end - + private def scale_color_value(value, amount) if amount > 0 diff --git a/lib/compass/sass_extensions/functions/constants.rb b/lib/compass/sass_extensions/functions/constants.rb index 846787f6..02be8ef8 100644 --- a/lib/compass/sass_extensions/functions/constants.rb +++ b/lib/compass/sass_extensions/functions/constants.rb @@ -1,5 +1,12 @@ module Compass::SassExtensions::Functions::Constants if defined?(Sass::Script::List) + POSITIONS = /top|bottom|left|right|center/ + def is_position(position) + Sass::Script::Bool.new(position.is_a?(Sass::Script::String) && !!(position.value =~ POSITIONS)) + end + def is_position_list(position_list) + Sass::Script::Bool.new(position_list.is_a?(Sass::Script::List) && position_list.value.all?{|p| is_position(p).to_bool}) + end # returns the opposite position of a side or corner. def opposite_position(position) position = unless position.is_a?(Sass::Script::List) diff --git a/lib/compass/sass_extensions/functions/cross_browser_support.rb b/lib/compass/sass_extensions/functions/cross_browser_support.rb index 92bab46e..ae82761f 100644 --- a/lib/compass/sass_extensions/functions/cross_browser_support.rb +++ b/lib/compass/sass_extensions/functions/cross_browser_support.rb @@ -1,4 +1,31 @@ module Compass::SassExtensions::Functions::CrossBrowserSupport + + class CSS2FallbackValue < Sass::Script::Literal + attr_accessor :value, :css2_value + def children + [value, css2_value] + end + def initialize(value, css2_value) + self.value = value + self.css2_value = css2_value + end + def inspect + to_s + end + def to_s(options = self.options) + value.to_s(options) + end + def supports?(aspect) + aspect == "css2" + end + def has_aspect? + true + end + def to_css2(options = self.options) + css2_value + end + end + # Check if any of the arguments passed require a vendor prefix. def prefixed(prefix, *args) aspect = prefix.value.sub(/^-/,"") @@ -6,7 +33,7 @@ module Compass::SassExtensions::Functions::CrossBrowserSupport Sass::Script::Bool.new(needed) end - %w(webkit moz o ms svg pie css2).each do |prefix| + %w(webkit moz o ms svg pie css2 owg).each do |prefix| class_eval <<-RUBY, __FILE__, __LINE__ + 1 # Syntactic sugar to apply the given prefix # -moz($arg) is the same as calling prefix(-moz, $arg) @@ -36,4 +63,8 @@ module Compass::SassExtensions::Functions::CrossBrowserSupport end end + def css2_fallback(value, css2_value) + CSS2FallbackValue.new(value, css2_value) + end + end diff --git a/lib/compass/sass_extensions/functions/gradient_support.rb b/lib/compass/sass_extensions/functions/gradient_support.rb index 1aadd511..17af3ad7 100644 --- a/lib/compass/sass_extensions/functions/gradient_support.rb +++ b/lib/compass/sass_extensions/functions/gradient_support.rb @@ -1,6 +1,6 @@ module Compass::SassExtensions::Functions::GradientSupport - GRADIENT_ASPECTS = %w(webkit moz svg pie css2).freeze + GRADIENT_ASPECTS = %w(webkit moz svg pie css2 o owg).freeze class ColorStop < Sass::Script::Literal attr_accessor :color, :stop @@ -33,124 +33,170 @@ module Compass::SassExtensions::Functions::GradientSupport end end - class RadialGradient < Sass::Script::Literal - attr_accessor :position_and_angle, :shape_and_size, :color_stops - def children - [color_stops, position_and_angle, shape_and_size].compact + module Gradient + + def self.included(base) + base.extend ClassMethods end - def initialize(position_and_angle, shape_and_size, color_stops) - unless color_stops.value.size >= 2 - raise Sass::SyntaxError, "At least two color stops are required for a radial-gradient" + + module ClassMethods + def standardized_prefix(prefix) + class_eval %Q{ + def to_#{prefix}(options = self.options) + Sass::Script::String.new("-#{prefix}-\#{to_s(options)}") + end + } end - self.position_and_angle = position_and_angle - self.shape_and_size = shape_and_size - self.color_stops = color_stops end + def inspect to_s end + + def supports?(aspect) + GRADIENT_ASPECTS.include?(aspect) + end + + def has_aspect? + true + end + + def angle?(value) + value.is_a?(Sass::Script::Number) && + value.numerator_units.size == 1 && + value.numerator_units.first == "deg" && + value.denominator_units.empty? + end + + end + + class RadialGradient < Sass::Script::Literal + include Gradient + + attr_accessor :position, :shape_and_size, :color_stops + + def children + [color_stops, position, shape_and_size].compact + end + + def initialize(position, shape_and_size, color_stops) + unless color_stops.value.size >= 2 + raise Sass::SyntaxError, "At least two color stops are required for a radial-gradient" + end + if angle?(position) + raise Sass::SyntaxError, "CSS no longer allows angles in radial-gradients." + end + self.position = position + self.shape_and_size = shape_and_size + self.color_stops = color_stops + end + def to_s(options = self.options) s = "radial-gradient(" - s << position_and_angle.to_s(options) << ", " if position_and_angle + s << position.to_s(options) << ", " if position s << shape_and_size.to_s(options) << ", " if shape_and_size s << color_stops.to_s(options) s << ")" end - def supports?(aspect) - GRADIENT_ASPECTS.include?(aspect) - end - def has_aspect? - true - end - def to_webkit(options = self.options) + + standardized_prefix :webkit + standardized_prefix :moz + standardized_prefix :o + + def to_owg(options = self.options) args = [ - grad_point(position_and_angle || _center_position), + grad_point(position || _center_position), Sass::Script::String.new("0"), - grad_point(position_and_angle || _center_position), + grad_point(position || _center_position), grad_end_position(color_stops, Sass::Script::Bool.new(true)), grad_color_stops(color_stops) ] args.each {|a| a.options = options} Sass::Script::String.new("-webkit-gradient(radial, #{args.join(', ')})") + end - end - def to_moz(options = self.options) - Sass::Script::String.new("-moz-#{to_s(options)}") - end def to_svg(options = self.options) # XXX Add shape support if possible - radial_svg_gradient(color_stops, position_and_angle || _center_position) + radial_svg_gradient(color_stops, position || _center_position) end + def to_pie(options = self.options) Compass::Logger.new.record(:warning, "PIE does not support radial-gradient.") Sass::Script::String.new("-pie-radial-gradient(unsupported)") end + def to_css2(options = self.options) Sass::Script::String.new("") end end class LinearGradient < Sass::Script::Literal - attr_accessor :color_stops, :position_and_angle + include Gradient + + attr_accessor :color_stops, :position_or_angle + def children - [color_stops, position_and_angle].compact + [color_stops, position_or_angle].compact end - def initialize(position_and_angle, color_stops) + + def initialize(position_or_angle, color_stops) unless color_stops.value.size >= 2 raise Sass::SyntaxError, "At least two color stops are required for a linear-gradient" end - self.position_and_angle = position_and_angle + self.position_or_angle = position_or_angle self.color_stops = color_stops end - def inspect - to_s - end + def to_s(options = self.options) s = "linear-gradient(" - s << position_and_angle.to_s(options) << ", " if position_and_angle + s << position_or_angle.to_s(options) << ", " if position_or_angle s << color_stops.to_s(options) s << ")" end - def supports?(aspect) - GRADIENT_ASPECTS.include?(aspect) - end - def has_aspect? - true - end - def to_webkit(options = self.options) + + standardized_prefix :webkit + standardized_prefix :moz + standardized_prefix :o + + # Output the original webkit gradient syntax + def to_owg(options = self.options) args = [] - args << grad_point(position_and_angle || Sass::Script::String.new("top")) - args << grad_point(opposite_position(position_and_angle || Sass::Script::String.new("top"))) + args << grad_point(position_or_angle || Sass::Script::String.new("top")) + args << linear_end_position(position_or_angle, color_stops) args << grad_color_stops(color_stops) args.each{|a| a.options = options} Sass::Script::String.new("-webkit-gradient(linear, #{args.join(', ')})") end - def to_moz(options = self.options) - Sass::Script::String.new("-moz-#{to_s(options)}") - end + def to_svg(options = self.options) - linear_svg_gradient(color_stops, position_and_angle || Sass::Script::String.new("top")) + linear_svg_gradient(color_stops, position_or_angle || Sass::Script::String.new("top")) end + def to_pie(options = self.options) # PIE just uses the standard rep, but the property is prefixed so # the presence of this attribute helps flag when to render a special rule. Sass::Script::String.new to_s(options) end + def to_css2(options = self.options) Sass::Script::String.new("") end end module Functions - # given a position list, return a corresponding position in percents + # otherwise, returns the original argument def grad_point(position) + original_value = position position = unless position.is_a?(Sass::Script::List) Sass::Script::List.new([position], :space) else Sass::Script::List.new(position.value.dup, position.separator) end - position.value.reject!{|p| p.is_a?(Sass::Script::Number) && p.numerator_units.include?("deg")} + # Handle unknown arguments by passing them along untouched. + unless position.value.all?{|p| is_position(p).to_bool } + return original_value + end if (position.value.first.value =~ /top|bottom/) or (position.value.last.value =~ /left|right/) # browsers are pretty forgiving of reversed positions so we are too. position.value.reverse! @@ -192,7 +238,7 @@ module Compass::SassExtensions::Functions::GradientSupport end, :comma) end - def radial_gradient(position_and_angle, shape_and_size, *color_stops) + def radial_gradient(position_or_angle, shape_and_size, *color_stops) # Have to deal with variable length/meaning arguments. if color_stop?(shape_and_size) color_stops.unshift(shape_and_size) @@ -203,38 +249,38 @@ module Compass::SassExtensions::Functions::GradientSupport shape_and_size = nil end shape_and_size = nil if shape_and_size && !shape_and_size.to_bool # nil out explictly passed falses - # ditto for position_and_angle - if color_stop?(position_and_angle) - color_stops.unshift(position_and_angle) - position_and_angle = nil - elsif list_of_color_stops?(position_and_angle) - color_stops = position_and_angle.value + color_stops - position_and_angle = nil + # ditto for position_or_angle + if color_stop?(position_or_angle) + color_stops.unshift(position_or_angle) + position_or_angle = nil + elsif list_of_color_stops?(position_or_angle) + color_stops = position_or_angle.value + color_stops + position_or_angle = nil end - position_and_angle = nil if position_and_angle && !position_and_angle.to_bool + position_or_angle = nil if position_or_angle && !position_or_angle.to_bool # Support legacy use of the color-stops() function if color_stops.size == 1 && list_of_color_stops?(color_stops.first) color_stops = color_stops.first.value end - RadialGradient.new(position_and_angle, shape_and_size, send(:color_stops, *color_stops)) + RadialGradient.new(position_or_angle, shape_and_size, send(:color_stops, *color_stops)) end - def linear_gradient(position_and_angle, *color_stops) - if color_stop?(position_and_angle) - color_stops.unshift(position_and_angle) - position_and_angle = nil - elsif list_of_color_stops?(position_and_angle) - color_stops = position_and_angle.value + color_stops - position_and_angle = nil + def linear_gradient(position_or_angle, *color_stops) + if color_stop?(position_or_angle) + color_stops.unshift(position_or_angle) + position_or_angle = nil + elsif list_of_color_stops?(position_or_angle) + color_stops = position_or_angle.value + color_stops + position_or_angle = nil end - position_and_angle = nil if position_and_angle && !position_and_angle.to_bool + position_or_angle = nil if position_or_angle && !position_or_angle.to_bool # Support legacy use of the color-stops() function - if color_stops.size == 1 && list_of_color_stops?(color_stops.first) - color_stops = color_stops.first.value + if color_stops.size == 1 && (stops = list_of_color_stops?(color_stops.first)) + color_stops = stops end - LinearGradient.new(position_and_angle, send(:color_stops, *color_stops)) + LinearGradient.new(position_or_angle, send(:color_stops, *color_stops)) end # returns color-stop() calls for use in webkit. @@ -255,14 +301,33 @@ module Compass::SassExtensions::Functions::GradientSupport stop = pos.stop stop = stop.div(max).times(Sass::Script::Number.new(100,["%"])) if stop.numerator_units == max.numerator_units && max.numerator_units != ["%"] # Make sure the color stops are specified in the right order. - if last_value && last_value.value > stop.value - raise Sass::SyntaxError.new("Color stops must be specified in increasing order") + if last_value && stop.numerator_units == last_value.numerator_units && stop.denominator_units == last_value.denominator_units && (stop.value * 1000).round < (last_value.value * 1000).round + raise Sass::SyntaxError.new("Color stops must be specified in increasing order. #{stop.value} came after #{last_value.value}.") end last_value = stop [stop, pos.color] end end + # only used for webkit + def linear_end_position(position_or_angle, color_list) + start_point = grad_point(position_or_angle || Sass::Script::String.new("top")) + end_point = grad_point(opposite_position(position_or_angle || Sass::Script::String.new("top"))) + end_target = color_list.value.last.stop + + if color_list.value.last.stop && color_list.value.last.stop.numerator_units == ["px"] + new_end = color_list.value.last.stop.value + if start_point.value.first == end_point.value.first && start_point.value.last.value == 0 + # this means top-to-bottom + end_point.value[1] = Sass::Script::Number.new(end_target.value) + elsif start_point.value.last == end_point.value.last && start_point.value.first.value == 0 + # this implies left-to-right + end_point.value[0] = Sass::Script::Number.new(end_target.value) + end + end + end_point + 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_type color_list, :List @@ -386,11 +451,19 @@ module Compass::SassExtensions::Functions::GradientSupport end def list_of_color_stops?(arg) - arg.value.is_a?(Array) && arg.value.all?{|a| a.is_a?(ColorStop)} + if arg.respond_to?(:value) + arg.value.is_a?(Array) && arg.value.all?{|a| color_stop?(a)} ? arg.value : nil + elsif arg.is_a?(Array) + arg.all?{|a| color_stop?(a)} ? arg : nil + end end - + def linear_svg(color_stops, x1, y1, x2, y2) - gradient = %Q{#{color_stops_svg(color_stops)}} + transform = '' + if angle?(position_or_angle) + transform = %Q{ gradientTransform = "rotate(#{position_or_angle.value})"} + end + gradient = %Q{#{color_stops_svg(color_stops)}} svg(gradient) end diff --git a/lib/compass/sass_extensions/functions/lists.rb b/lib/compass/sass_extensions/functions/lists.rb index e82a6757..a9e15a0c 100644 --- a/lib/compass/sass_extensions/functions/lists.rb +++ b/lib/compass/sass_extensions/functions/lists.rb @@ -18,8 +18,9 @@ module Compass::SassExtensions::Functions::Lists def compact(*args) sep = :comma if args.size == 1 && args.first.is_a?(Sass::Script::List) - args = args.first.value - sep = args.first.separator + list = args.first + args = list.value + sep = list.separator end Sass::Script::List.new(args.reject{|a| !a.to_bool}, sep) end diff --git a/lib/compass/sass_extensions/functions/sprites.rb b/lib/compass/sass_extensions/functions/sprites.rb index 7df04e20..18ca2009 100644 --- a/lib/compass/sass_extensions/functions/sprites.rb +++ b/lib/compass/sass_extensions/functions/sprites.rb @@ -1,8 +1,6 @@ -require 'digest/md5' - module Compass::SassExtensions::Functions::Sprites ZERO = Sass::Script::Number::new(0) - + VALID_SELECTORS = %w(hover active target) # Provides a consistent interface for getting a variable in ruby # from a keyword argument hash that accounts for underscores/dash equivalence # and allows the caller to pass a symbol instead of a string. @@ -12,220 +10,7 @@ module Compass::SassExtensions::Functions::Sprites end end - class SpriteMap < Sass::Script::Literal - - # Changing this string will invalidate all previously generated sprite images. - # We should do so only when the packing algorithm changes - SPRITE_VERSION = "1" - - attr_accessor :image_names, :path, :name, :options - attr_accessor :images, :width, :height - - def self.from_uri(uri, context, kwargs) - path, name = Compass::Sprites.path_and_name(uri.value) - sprites = Compass::Sprites.discover_sprites(uri.value).map do |sprite| - sprite.gsub(Compass.configuration.images_path+"/", "") - end - new(sprites, path, name, context, kwargs) - end - - def initialize(image_names, path, name, context, options) - @image_names, @path, @name, @options = image_names, path, name, options - @images = nil - @width = nil - @height = nil - @evaluation_context = context - validate! - compute_image_metadata! - end - - def sprite_names - image_names.map{|f| Compass::Sprites.sprite_name(f) } - end - - def validate! - for sprite_name in sprite_names - unless sprite_name =~ /\A#{Sass::SCSS::RX::IDENT}\Z/ - raise Sass::SyntaxError, "#{sprite_name} must be a legal css identifier" - end - end - end - - # Calculates the overal image dimensions - # collects image sizes and input parameters for each sprite - def compute_image_metadata! - @images = [] - @width = 0 - image_names.each do |relative_file| - file = File.join(Compass.configuration.images_path, relative_file) - width, height = Compass::SassExtensions::Functions::ImageSize::ImageProperties.new(file).size - sprite_name = Compass::Sprites.sprite_name(relative_file) - position = position_for(sprite_name) - offset = (position.unitless? || position.unit_str == "px") ? position.value : 0 - @images << { - :name => sprite_name, - :file => file, - :relative_file => relative_file, - :height => height, - :width => width, - :repeat => repeat_for(sprite_name), - :spacing => spacing_for(sprite_name), - :position => position, - :digest => Digest::MD5.file(file).hexdigest - } - @width = [@width, width + offset].max - end - @images.each_with_index do |image, index| - if index == 0 - image[:top] = 0 - else - last_image = @images[index-1] - image[:top] = last_image[:top] + last_image[:height] + [image[:spacing], last_image[:spacing]].max - end - if image[:position].unit_str == "%" - image[:left] = (@width - image[:width]) * (image[:position].value / 100) - else - image[:left] = image[:position].value - end - end - @height = @images.last[:top] + @images.last[:height] - end - - def position_for(name) - options.get_var("#{name}-position") || options.get_var("position") || Sass::Script::Number.new(0, ["px"]) - end - - def repeat_for(name) - if (var = options.get_var("#{name}-repeat")) - var.value - elsif (var = options.get_var("repeat")) - var.value - else - "no-repeat" - end - end - - def spacing_for(name) - (options.get_var("#{name}-spacing") || - options.get_var("spacing") || - ZERO).value - end - - def image_for(name) - @images.detect{|img| img[:name] == name} - end - - # Calculate the size of the sprite - def size - [width, height] - end - - # Generate a sprite image if necessary - def generate - if generation_required? - save!(construct_sprite) - end - end - - def generation_required? - !File.exists?(filename) || outdated? - end - - def require_png_library! - begin - require 'oily_png' - rescue LoadError - require 'chunky_png' - end - end - - # Returns a PNG object - def construct_sprite - require_png_library! - output_png = ChunkyPNG::Image.new(width, height, ChunkyPNG::Color::TRANSPARENT) - images.each do |image| - input_png = ChunkyPNG::Image.from_file(image[:file]) - if image[:repeat] == "no-repeat" - output_png.replace input_png, image[:left], image[:top] - else - x = image[:left] - (image[:left] / image[:width]).ceil * image[:width] - while x < width do - output_png.replace input_png, x, image[:top] - x += image[:width] - end - end - end - output_png - end - - # The on-the-disk filename of the sprite - def filename - File.join(Compass.configuration.images_path, "#{path}-#{uniqueness_hash}.png") - end - - def uniqueness_hash - @uniqueness_hash ||= begin - sum = Digest::MD5.new - sum << SPRITE_VERSION - sum << path - images.each do |image| - [:relative_file, :height, :width, :repeat, :spacing, :position, :digest].each do |attr| - sum << image[attr].to_s - end - end - sum.hexdigest[0...10] - end - @uniqueness_hash - end - - # saves the sprite for later retrieval - def save!(output_png) - output_png.save filename - end - - # All the full-path filenames involved in this sprite - def image_filenames - image_names.map do |image_name| - File.join(Compass.configuration.images_path, image_name) - end - end - - # Checks whether this sprite is outdated - def outdated? - last_update = self.mtime - image_filenames.each do |image| - return true if File.mtime(image) > last_update - end - false - end - - def mtime - File.mtime(filename) - end - - def inspect - to_s - end - - def to_s(options = self.options) - sprite_url(self).value - end - - def respond_to?(meth) - super || @evaluation_context.respond_to?(meth) - end - - def method_missing(meth, *args, &block) - if @evaluation_context.respond_to?(meth) - @evaluation_context.send(meth, *args, &block) - else - super - end - end - - end - - # Creates a SpriteMap object. A sprite map, when used in a property is the same + # Creates a Compass::SassExtensions::Sprites::Base object. A sprite map, when used in a property is the same # as calling sprite-url. So the following background properties are equivalent: # # $icons: sprite-map("icons/*.png"); @@ -236,7 +21,7 @@ module Compass::SassExtensions::Functions::Sprites # the first time it is converted to a url. Simply constructing it has no side-effects. def sprite_map(glob, kwargs = {}) kwargs.extend VariableReader - SpriteMap.from_uri(glob, self, kwargs) + Compass::SassExtensions::Sprites::Base.from_uri(glob, self, kwargs) end Sass::Script::Functions.declare :sprite_map, [:glob], :var_kwargs => true @@ -249,9 +34,7 @@ module Compass::SassExtensions::Functions::Sprites # # background: url('/images/icons.png?12345678') 0 -24px no-repeat; def sprite(map, sprite, offset_x = ZERO, offset_y = ZERO) - unless map.is_a?(SpriteMap) - missing_sprite!("sprite") - end + verify_map(map) unless sprite.is_a?(Sass::Script::String) raise Sass::SyntaxError, %Q(The second argument to sprite() must be a sprite name. See http://beta.compass-style.org/help/tutorials/spriting/ for more information.) end @@ -266,31 +49,48 @@ module Compass::SassExtensions::Functions::Sprites # Returns the name of a sprite map # The name is derived from the folder than contains the sprites. def sprite_map_name(map) - unless map.is_a?(SpriteMap) - missing_sprite!("sprite-map-name") - end + verify_map(map, "sprite-map-name") Sass::Script::String.new(map.name) end Sass::Script::Functions.declare :sprite_name, [:sprite] # Returns the path to the original image file for the sprite with the given name def sprite_file(map, sprite) - unless map.is_a?(SpriteMap) - missing_sprite!("sprite-file") - end + verify_map(map, "sprite") + verify_sprite(sprite) if image = map.image_for(sprite.value) - Sass::Script::String.new(image[:relative_file]) + Sass::Script::String.new(image.relative_file) else missing_image!(map, sprite) end end Sass::Script::Functions.declare :sprite_file, [:map, :sprite] - + + # Returns voolean if sprite has a parent + def sprite_does_not_have_parent(map, sprite) + verify_map map + verify_sprite sprite + Sass::Script::Bool.new map.image_for(sprite.value).parent.nil? + end + + Sass::Script::Functions.declare :sprite_does_not_have_parent, [:map, :sprite] + + # Returns boolean if sprite has the selector + def sprite_has_selector(map, sprite, selector) + verify_map map + verify_sprite sprite + unless VALID_SELECTORS.include?(selector.value) + raise Sass::SyntaxError, "Invalid Selctor did you mean one of: #{VALID_SELECTORS.join(', ')}" + end + Sass::Script::Bool.new map.send(:"has_#{selector.value}?", sprite) + end + + Sass::Script::Functions.declare :sprite_has_selector, [:map, :sprite, :selector] + + # Returns a url to the sprite image. def sprite_url(map) - unless map.is_a?(SpriteMap) - missing_sprite!("sprite-url") - end + verify_map(map, "sprite-url") map.generate image_url(Sass::Script::String.new("#{map.path}-#{map.uniqueness_hash}.png"), Sass::Script::Bool.new(false), @@ -318,9 +118,7 @@ module Compass::SassExtensions::Functions::Sprites # # background-position: 3px -36px; def sprite_position(map, sprite = nil, offset_x = ZERO, offset_y = ZERO) - unless map.is_a?(SpriteMap) - missing_sprite!("sprite-position") - end + verify_map(map, "sprite-position") unless sprite && sprite.is_a?(Sass::Script::String) raise Sass::SyntaxError, %Q(The second argument to sprite-position must be a sprite name. See http://beta.compass-style.org/help/tutorials/spriting/ for more information.) end @@ -331,10 +129,10 @@ module Compass::SassExtensions::Functions::Sprites if offset_x.unit_str == "%" x = offset_x # CE: Shouldn't this be a percentage of the total width? else - x = offset_x.value - image[:left] + x = offset_x.value - image.left x = Sass::Script::Number.new(x, x == 0 ? [] : ["px"]) end - y = offset_y.value - image[:top] + y = offset_y.value - image.top y = Sass::Script::Number.new(y, y == 0 ? [] : ["px"]) Sass::Script::List.new([x, y],:space) end @@ -349,6 +147,18 @@ module Compass::SassExtensions::Functions::Sprites protected + def verify_map(map, error = "sprite") + unless map.is_a?(Compass::SassExtensions::Sprites::Base) + missing_sprite!(error) + end + end + + def verify_sprite(sprite) + unless sprite.is_a?(Sass::Script::String) + raise Sass::SyntaxError, %Q(The second argument to sprite() must be a sprite name. See http://beta.compass-style.org/help/tutorials/spriting/ for more information.) + end + end + def missing_image!(map, sprite) raise Sass::SyntaxError, "No sprite called #{sprite} found in sprite map #{map.path}/#{map.name}. Did you mean one of: #{map.sprite_names.join(", ")}" end diff --git a/lib/compass/sass_extensions/monkey_patches/browser_support.rb b/lib/compass/sass_extensions/monkey_patches/browser_support.rb index c1b55e58..6dfa63d8 100644 --- a/lib/compass/sass_extensions/monkey_patches/browser_support.rb +++ b/lib/compass/sass_extensions/monkey_patches/browser_support.rb @@ -65,7 +65,13 @@ module Sass::Script class Funcall < Node include HasSimpleCrossBrowserFunctionSupport - alias sass_to_literal to_literal + if method_defined? :to_literal + alias sass_to_literal to_literal + else + def sass_to_literal + Script::String.new("#{name}(#{args.join(', ')})") + end + end def to_literal(args) if has_aspect?(args) diff --git a/lib/compass/sass_extensions/sprites.rb b/lib/compass/sass_extensions/sprites.rb new file mode 100644 index 00000000..85765179 --- /dev/null +++ b/lib/compass/sass_extensions/sprites.rb @@ -0,0 +1,14 @@ +require 'digest/md5' +require 'compass/sass_extensions/sprites/sprites' +require 'compass/sass_extensions/sprites/sprite_map' +require 'compass/sass_extensions/sprites/image' +require 'compass/sass_extensions/sprites/base' +require 'compass/sass_extensions/sprites/engines' + +module Compass + module SassExtensions + module Sprites + + end + end +end \ No newline at end of file diff --git a/lib/compass/sass_extensions/sprites/base.rb b/lib/compass/sass_extensions/sprites/base.rb new file mode 100644 index 00000000..aa671b39 --- /dev/null +++ b/lib/compass/sass_extensions/sprites/base.rb @@ -0,0 +1,201 @@ +module Compass + module SassExtensions + module Sprites + class Base < Sass::Script::Literal + + + # Initialize a new aprite object from a relative file path + # the path is relative to the images_path confguration option + def self.from_uri(uri, context, kwargs) + sprite_map = ::Compass::SpriteMap.new(uri.value, {}) + + sprites = sprite_map.files.map do |sprite| + sprite.gsub(Compass.configuration.images_path+"/", "") + end + new(sprites, sprite_map.path, sprite_map.name, context, kwargs) + end + + # Loads the sprite engine + def require_engine! + self.class.send(:include, eval("::Compass::SassExtensions::Sprites::#{modulize}Engine")) + end + + # Changing this string will invalidate all previously generated sprite images. + # We should do so only when the packing algorithm changes + SPRITE_VERSION = "1" + + attr_accessor :image_names, :path, :name, :options + attr_accessor :images, :width, :height + + + def initialize(image_names, path, name, context, options) + require_engine! + @image_names, @path, @name, @options = image_names, path, name, options + @images = nil + @width = nil + @height = nil + @evaluation_context = context + validate! + compute_image_metadata! + end + + # Calculate the size of the sprite + def size + [width, height] + end + + # Calculates the overal image dimensions + # collects image sizes and input parameters for each sprite + # Calculates the height + def compute_image_metadata! + @width = 0 + init_images + compute_image_positions! + @height = @images.last.top + @images.last.height + end + + # Creates the Sprite::Image objects for each image and calculates the width + def init_images + @images = image_names.collect do |relative_file| + image = Compass::SassExtensions::Sprites::Image.new(self, relative_file, options) + @width = [ @width, image.width + image.offset ].max + image + end + end + + # Calculates the overal image dimensions + # collects image sizes and input parameters for each sprite + def compute_image_positions! + @images.each_with_index do |image, index| + image.left = image.position.unit_str == "%" ? (@width - image.width) * (image.position.value / 100) : image.position.value + next if index == 0 + last_image = @images[index-1] + image.top = last_image.top + last_image.height + [image.spacing, last_image.spacing].max + end + end + + # Fetches the Sprite::Image object for the supplied name + def image_for(name) + @images.detect { |img| img.name == name} + end + + # Returns true if the image name has a hover selector image + def has_hover?(name) + !image_for("#{name}_hover").nil? + end + + # Returns true if the image name has a target selector image + def has_target?(name) + !image_for("#{name}_target").nil? + end + + # Returns true if the image name has an active selector image + def has_active?(name) + !image_for("#{name}_active").nil? + end + + # Return and array of image names that make up this sprite + def sprite_names + image_names.map { |f| File.basename(f, '.png') } + end + + + # Validates that the sprite_names are valid sass + def validate! + for sprite_name in sprite_names + unless sprite_name =~ /\A#{Sass::SCSS::RX::IDENT}\Z/ + raise Sass::SyntaxError, "#{sprite_name} must be a legal css identifier" + end + end + end + + # The on-the-disk filename of the sprite + def filename + File.join(Compass.configuration.images_path, "#{path}-#{uniqueness_hash}.png") + end + + # Generate a sprite image if necessary + def generate + if generation_required? + sprite_data = construct_sprite + save!(sprite_data) + Compass.configuration.run_callback(:sprite_generated, sprite_data) + end + end + + # Does this sprite need to be generated + def generation_required? + !File.exists?(filename) || outdated? + end + + # Returns the uniqueness hash for this sprite object + def uniqueness_hash + @uniqueness_hash ||= begin + sum = Digest::MD5.new + sum << SPRITE_VERSION + sum << path + images.each do |image| + [:relative_file, :height, :width, :repeat, :spacing, :position, :digest].each do |attr| + sum << image.send(attr).to_s + end + end + sum.hexdigest[0...10] + end + @uniqueness_hash + end + + # Saves the sprite engine + def save!(output_png) + saved = output_png.save filename + Compass.configuration.run_callback(:sprite_saved, filename) + saved + end + + # All the full-path filenames involved in this sprite + def image_filenames + @images.map(&:file) + end + + # Checks whether this sprite is outdated + def outdated? + if File.exists?(filename) + return @images.map(&:mtime).any? { |imtime| imtime.to_i > self.mtime.to_i } + end + true + end + + # Mtime of the sprite file + def mtime + @mtime ||= File.mtime(filename) + end + + def inspect + to_s + end + + def to_s(options = self.options) + sprite_url(self).value + end + + def respond_to?(meth) + super || @evaluation_context.respond_to?(meth) + end + + def method_missing(meth, *args, &block) + if @evaluation_context.respond_to?(meth) + @evaluation_context.send(meth, *args, &block) + else + super + end + end + + private + + def modulize + @modulize ||= Compass::configuration.sprite_engine.to_s.scan(/([^_.]+)/).flatten.map {|chunk| "#{chunk[0].chr.upcase}#{chunk[1..-1]}" }.join + end + + end + end + end +end diff --git a/lib/compass/sass_extensions/sprites/engines.rb b/lib/compass/sass_extensions/sprites/engines.rb new file mode 100644 index 00000000..26a73260 --- /dev/null +++ b/lib/compass/sass_extensions/sprites/engines.rb @@ -0,0 +1 @@ +require 'compass/sass_extensions/sprites/engines/chunky_png_engine' \ No newline at end of file diff --git a/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb b/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb new file mode 100644 index 00000000..dd7a6455 --- /dev/null +++ b/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb @@ -0,0 +1,36 @@ +begin + require 'oily_png' +rescue LoadError + require 'chunky_png' +end + +module Compass + module SassExtensions + module Sprites + module ChunkyPngEngine + + # Returns a PNG object + def construct_sprite + output_png = ChunkyPNG::Image.new(width, height, ChunkyPNG::Color::TRANSPARENT) + images.each do |image| + input_png = ChunkyPNG::Image.from_file(image.file) + if image.repeat == "no-repeat" + output_png.replace! input_png, image.left, image.top + else + x = image.left - (image.left / image.width).ceil * image.width + while x < width do + begin + output_png.replace! input_png, x, image.top + x += image.width + rescue ChunkyPNG::OutOfBounds + break; + end + end + end + end + output_png + end + end + end + end +end \ No newline at end of file diff --git a/lib/compass/sass_extensions/sprites/image.rb b/lib/compass/sass_extensions/sprites/image.rb new file mode 100644 index 00000000..3a3e57cf --- /dev/null +++ b/lib/compass/sass_extensions/sprites/image.rb @@ -0,0 +1,119 @@ +module Compass + module SassExtensions + module Sprites + class Image + ACTIVE = %r{[_-]active$} + TARGET = %r{[_-]target$} + HOVER = %r{[_-]hover$} + PARENT = %r{(.+)[-_](.+)$} + + attr_reader :relative_file, :options, :base + attr_accessor :top, :left + + def initialize(base, relative_file, options) + @base, @relative_file, @options = base, relative_file, options + @left = @top = 0 + end + + # The Full path to the image + def file + File.join(Compass.configuration.images_path, relative_file) + end + + # Width of the image + def width + dimensions.first + end + + # Height of the image + def height + dimensions.last + end + + # Basename of the image + def name + File.basename(relative_file, '.png') + end + + # Value of $#{name}-repeat or $repeat + def repeat + [ "#{name}-repeat", "repeat" ].each { |which| + if var = options.get_var(which) + return var.value + end + } + "no-repeat" + end + + # Value of $#{name}-position or $position defaults o 0px + def position + options.get_var("#{name}-position") || options.get_var("position") || Sass::Script::Number.new(0, ["px"]) + end + + # Offset within the sprite + def offset + (position.unitless? || position.unit_str == "px") ? position.value : 0 + end + + # Spacing between this image and the next + def spacing + (options.get_var("#{name}-spacing") || options.get_var("spacing") || Sass::Script::Number.new(0)).value + end + + # MD5 hash of this file + def digest + Digest::MD5.file(file).hexdigest + end + + # mtime of this file + def mtime + File.mtime(file) + end + + # Is hover selector + def hover? + name =~ HOVER + end + + # Hover selector Image object if exsists + def hover + base.image_for("#{name}_hover") + end + + # Is target selector + def target? + name =~ TARGET + end + + # Target selector Image object if exsists + def target + base.image_for("#{name}_target") + end + + # Is active selector + def active? + name =~ ACTIVE + end + + # Active selector Image object if exsists + def active + base.image_for("#{name}_active") + end + + + def parent + if [hover?, target?, active?].any? + PARENT.match name + base.image_for($1) + end + end + + + private + def dimensions + @dimensions ||= Compass::SassExtensions::Functions::ImageSize::ImageProperties.new(file).size + end + end + end + end +end diff --git a/lib/compass/sprites.rb b/lib/compass/sass_extensions/sprites/sprite_map.rb similarity index 50% rename from lib/compass/sprites.rb rename to lib/compass/sass_extensions/sprites/sprite_map.rb index 707d9bdb..f2106739 100644 --- a/lib/compass/sprites.rb +++ b/lib/compass/sass_extensions/sprites/sprite_map.rb @@ -1,41 +1,68 @@ module Compass - class Sprites < Sass::Importers::Base - attr_accessor :name - attr_accessor :path - - class << self - def path_and_name(uri) - if uri =~ %r{((.+/)?(.+))/(.+?)\.png} - [$1, $3, $4] - end - end - - def discover_sprites(uri) - glob = File.join(Compass.configuration.images_path, uri) - Dir.glob(glob).sort - end - - def sprite_name(file) - File.basename(file, '.png') - end - - end + class SpriteMap + attr_reader :uri, :options + VAILD_FILE_NAME = /\A#{Sass::SCSS::RX::IDENT}\Z/ def find_relative(*args) nil end - def find(uri, options) - if uri =~ /\.png$/ - self.path, self.name = Compass::Sprites.path_and_name(uri) - options.merge! :filename => name, :syntax => :scss, :importer => self - sprite_files = Compass::Sprites.discover_sprites(uri) - image_names = sprite_files.map {|i| Compass::Sprites.sprite_name(i) } - Sass::Engine.new(content_for_images(uri, name, image_names), options) - end + def initialize(uri, options) + @uri, @options = uri, options end - def content_for_images(uri, name, images) + # Name of this spite + def name + ensure_path_and_name! + @name + end + + # The on-disk location of this sprite + def path + ensure_path_and_name! + @path + end + + # Returns the Glob of image files for this sprite + def files + @files ||= Dir[File.join(Compass.configuration.images_path, uri)].sort + end + + # Returns an Array of image names without the file extension + def sprite_names + @sprite_names ||= files.collect do |file| + filename = File.basename(file, '.png') + unless VAILD_FILE_NAME =~ filename + raise Compass::Error, "Sprite file names must be legal css identifiers. Please rename #{File.basename(file)}" + end + filename + end + end + + # Returns the sass options for this sprite + def sass_options + @sass_options ||= options.merge(:filename => name, :syntax => :scss, :importer => self) + end + + # Returns a Sass::Engine for this sprite object + def sass_engine + Sass::Engine.new(content_for_images, sass_options) + end + + def ensure_path_and_name! + @path, @name = Compass::Sprites.path_and_name(uri) + end + + def key(uri, options) + Compass::Sprites.key(uri) + end + + def mtime(uri, options) + Compass::Sprites.mtime(uri, options) + end + + # Generates the Sass for this sprite file + def content_for_images(skip_overrides = false) <<-SCSS @import "compass/utilities/sprites/base"; @@ -46,23 +73,9 @@ $#{name}-sprite-dimensions: false !default; $#{name}-position: 0% !default; $#{name}-spacing: 0 !default; $#{name}-repeat: no-repeat !default; +$#{name}-prefix: '' !default; -// These variables control the generated sprite output -// You can override them selectively before you import this file. -#{images.map do |sprite_name| -<<-SCSS -$#{name}-#{sprite_name}-position: $#{name}-position !default; -$#{name}-#{sprite_name}-spacing: $#{name}-spacing !default; -$#{name}-#{sprite_name}-repeat: $#{name}-repeat !default; -SCSS -end.join} - -$#{name}-sprites: sprite-map("#{uri}", -#{images.map do |sprite_name| -%Q{ $#{sprite_name}-position: $#{name}-#{sprite_name}-position, - $#{sprite_name}-spacing: $#{name}-#{sprite_name}-spacing, - $#{sprite_name}-repeat: $#{name}-#{sprite_name}-repeat} -end.join(",\n")}); +#{skip_overrides ? "$#{name}-sprites: sprite-map(\"#{uri}\");" : generate_overrides } // All sprites should extend this class // The #{name}-sprite mixin will do so for you. @@ -78,7 +91,7 @@ end.join(",\n")}); // Move the background position to display the sprite. @mixin #{name}-sprite-position($name, $offset-x: 0, $offset-y: 0) { - @include sprite-position($#{name}-sprites, $name, $offset-x, $offset-y) + @include sprite-background-position($#{name}-sprites, $name, $offset-x, $offset-y) } // Extends the sprite base class and set the background position for the desired sprite. @@ -94,29 +107,36 @@ end.join(",\n")}); // Generates a class for each sprited image. @mixin all-#{name}-sprites($dimensions: $#{name}-sprite-dimensions, $prefix: sprite-map-name($#{name}-sprites)) { - @include #{name}-sprites(#{images.join(" ")}, $dimensions, $prefix); + @include #{name}-sprites(#{sprite_names.join(" ")}, $dimensions, $prefix); } SCSS end - - def key(uri, options) - [self.class.name + ":" + File.dirname(File.expand_path(uri)), - File.basename(uri)] - end - - def mtime(uri, options) - Compass.quick_cache("mtime:#{uri}") do - self.path, self.name = Compass::Sprites.path_and_name(uri) - glob = File.join(Compass.configuration.images_path, uri) - Dir.glob(glob).inject(Time.at(0)) do |max_time, file| - (t = File.mtime(file)) > max_time ? t : max_time - end - end - end - def to_s - "" - end + # Generates the override defaults for this Sprite + # $#{name}-#{sprite_name}-position + # $#{name}-#{sprite_name}-spacing + # #{name}-#{sprite_name}-repeat: + def generate_overrides + content = <<-TXT +// These variables control the generated sprite output +// You can override them selectively before you import this file. + TXT + sprite_names.map do |sprite_name| + content += <<-SCSS +$#{name}-#{sprite_name}-position: $#{name}-position !default; +$#{name}-#{sprite_name}-spacing: $#{name}-spacing !default; +$#{name}-#{sprite_name}-repeat: $#{name}-repeat !default; + SCSS + end.join + content += "\n$#{name}-sprites: sprite-map(\"#{uri}\",\n" + content += sprite_names.map do |sprite_name| +%Q{ $#{sprite_name}-position: $#{name}-#{sprite_name}-position, + $#{sprite_name}-spacing: $#{name}-#{sprite_name}-spacing, + $#{sprite_name}-repeat: $#{name}-#{sprite_name}-repeat} + end.join(",\n") + content += ");" + end end -end \ No newline at end of file +end + diff --git a/lib/compass/sass_extensions/sprites/sprites.rb b/lib/compass/sass_extensions/sprites/sprites.rb new file mode 100644 index 00000000..c0c5dc21 --- /dev/null +++ b/lib/compass/sass_extensions/sprites/sprites.rb @@ -0,0 +1,62 @@ +module Compass + class Sprites < Sass::Importers::Base + attr_accessor :name, :path + + def self.path_and_name(uri) + if uri =~ %r{((.+/)?(.+))/(.+?)\.png} + [$1, $3, $4] + end + end + + def self.discover_sprites(uri) + self.load_map(uri, {}).files + end + + def self.sprite_name(file) + File.basename(file, '.png') + end + + def self.load_map(uri, options) + Compass.quick_cache("spritemap:#{uri}", 5) do + SpriteMap.new(uri, options) + end + end + + + # Called by the sass engine to build a new SpriteMap + def find(uri, options) + if uri =~ /\.png$/ + map = Compass::Sprites.load_map(uri, options) + self.path, self.name = map.path, map.name + return map.sass_engine + end + end + + # Called by the sass engine to identify the SpriteMap + def self.key(uri, options={}) + [self.class.name + ":" + File.dirname(File.expand_path(uri)), File.basename(uri)] + end + + def self.mtime(uri, options) + Compass.quick_cache("mtime:#{uri}") do + map = Compass::Sprites.load_map(uri, options) + map.files.inject(Time.at(0)) do |max_time, file| + (t = File.mtime(file)) > max_time ? t : max_time + end + end + end + + def to_s + "" + end + + def hash + self.class.name.hash + end + + def eql?(other) + other.class == self.class + end + + end +end diff --git a/lib/compass/util.rb b/lib/compass/util.rb index 516be5f9..4e75dd03 100644 --- a/lib/compass/util.rb +++ b/lib/compass/util.rb @@ -15,4 +15,15 @@ module Compass::Util send(WARN_METHOD, *args) end + def blank?(value) + case value + when NilClass, FalseClass + true + when String, Array + value.length.zero? + else + false + end + end + end diff --git a/lib/compass/version.rb b/lib/compass/version.rb index f7eaa141..277ac1e2 100644 --- a/lib/compass/version.rb +++ b/lib/compass/version.rb @@ -23,7 +23,7 @@ module Compass def read_version require 'yaml' @version = YAML::load(File.read(scope('VERSION.yml'))) - @version[:teeny] = @version[:patch] + @version[:teeny] = @version[:patch] @version[:string] = "#{@version[:major]}.#{@version[:minor]}" @version[:string] << ".#{@version[:patch]}" if @version[:patch] @version[:string] << ".#{@version[:state]}" if @version[:state] diff --git a/lib/vendor/fssm/fssm.rb b/lib/vendor/fssm/fssm.rb deleted file mode 100644 index 058cbf3c..00000000 --- a/lib/vendor/fssm/fssm.rb +++ /dev/null @@ -1,33 +0,0 @@ -dir = File.dirname(__FILE__) -$LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir) - -module FSSM - FileNotFoundError = Class.new(StandardError) - CallbackError = Class.new(StandardError) - - class << self - def dbg(msg=nil) - STDERR.puts(msg) - end - - def monitor(*args, &block) - monitor = FSSM::Monitor.new - FSSM::Support.use_block(args.empty? ? monitor : monitor.path(*args), block) - - monitor.run - end - end -end - -require 'thread' - -require 'fssm/pathname' -require 'fssm/support' -require 'fssm/tree' -require 'fssm/path' -require 'fssm/state/directory' -require 'fssm/state/file' -require 'fssm/monitor' - -require "fssm/backends/#{FSSM::Support.backend.downcase}" -FSSM::Backends::Default = FSSM::Backends.const_get(FSSM::Support.backend) diff --git a/lib/vendor/fssm/fssm/backends/fsevents.rb b/lib/vendor/fssm/fssm/backends/fsevents.rb deleted file mode 100644 index 800cebd1..00000000 --- a/lib/vendor/fssm/fssm/backends/fsevents.rb +++ /dev/null @@ -1,36 +0,0 @@ -require File.join(File.dirname(__FILE__), 'rubycocoa/fsevents') - -module FSSM::Backends - class FSEvents - def initialize - @handlers = {} - @fsevents = [] - end - - def add_handler(handler, preload=true) - @handlers[handler.path.to_s] = handler - - fsevent = Rucola::FSEvents.new(handler.path.to_s, {:latency => 0.5}) do |events| - events.each do |event| - handler.refresh(event.path) - end - end - - fsevent.create_stream - handler.refresh(nil, true) if preload - fsevent.start - @fsevents << fsevent - end - - def run - begin - OSX.CFRunLoopRun - rescue Interrupt - @fsevents.each do |fsev| - fsev.stop - end - end - end - - end -end diff --git a/lib/vendor/fssm/fssm/backends/inotify.rb b/lib/vendor/fssm/fssm/backends/inotify.rb deleted file mode 100644 index 74af1bcf..00000000 --- a/lib/vendor/fssm/fssm/backends/inotify.rb +++ /dev/null @@ -1,26 +0,0 @@ -module FSSM::Backends - class Inotify - def initialize - @notifier = INotify::Notifier.new - end - - def add_handler(handler, preload=true) - @notifier.watch(handler.path.to_s, :recursive, :attrib, :modify, :create, - :delete, :delete_self, :moved_from, :moved_to, :move_self) do |event| - path = FSSM::Pathname.for(event.absolute_name) - path = path.dirname unless event.name == "" # Event on root directory - handler.refresh(path) - end - - handler.refresh(nil, true) if preload - end - - def run - begin - @notifier.run - rescue Interrupt - end - end - - end -end diff --git a/lib/vendor/fssm/fssm/backends/polling.rb b/lib/vendor/fssm/fssm/backends/polling.rb deleted file mode 100644 index 083cf07b..00000000 --- a/lib/vendor/fssm/fssm/backends/polling.rb +++ /dev/null @@ -1,25 +0,0 @@ -module FSSM::Backends - class Polling - def initialize(options={}) - @handlers = [] - @latency = options[:latency] || 1.5 - end - - def add_handler(handler, preload=true) - handler.refresh(nil, true) if preload - @handlers << handler - end - - def run - begin - loop do - start = Time.now.to_f - @handlers.each {|handler| handler.refresh} - nap_time = @latency - (Time.now.to_f - start) - sleep nap_time if nap_time > 0 - end - rescue Interrupt - end - end - end -end diff --git a/lib/vendor/fssm/fssm/backends/rubycocoa/fsevents.rb b/lib/vendor/fssm/fssm/backends/rubycocoa/fsevents.rb deleted file mode 100644 index 7a1dbab7..00000000 --- a/lib/vendor/fssm/fssm/backends/rubycocoa/fsevents.rb +++ /dev/null @@ -1,131 +0,0 @@ -OSX.require_framework '/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework' - -module Rucola - class FSEvents - class FSEvent - attr_reader :fsevents_object - attr_reader :id - attr_reader :path - - def initialize(fsevents_object, id, path) - @fsevents_object, @id, @path = fsevents_object, id, path - end - - # Returns an array of the files/dirs in the path that the event occurred in. - # The files are sorted by the modification time, the first entry is the last modified file. - def files - Dir.glob("#{File.expand_path(path)}/*").sort_by {|f| File.mtime(f) }.reverse - end - - # Returns the last modified file in the path that the event occurred in. - def last_modified_file - files.first - end - end - - class StreamError < StandardError; - end - - attr_reader :paths - attr_reader :stream - - attr_accessor :allocator - attr_accessor :context - attr_accessor :since - attr_accessor :latency - attr_accessor :flags - - # Initializes a new FSEvents `watchdog` object and starts watching the directories you specify for events. The - # block is used as a handler for events, which are passed as the block's argument. This method is the easiest - # way to start watching some directories if you don't care about the details of setting up the event stream. - # - # Rucola::FSEvents.start_watching('/tmp') do |events| - # events.each { |event| log.debug("#{event.files.inspect} were changed.") } - # end - # - # Rucola::FSEvents.start_watching('/var/log/system.log', '/var/log/secure.log', :since => last_id, :latency => 5) do - # Growl.notify("Something was added to your log files!") - # end - # - # Note that the method also returns the FSEvents object. This enables you to control the event stream if you want to. - # - # fsevents = Rucola::FSEvents.start_watching('/Volumes') do |events| - # events.each { |event| Growl.notify("Volume changes: #{event.files.to_sentence}") } - # end - # fsevents.stop - def self.start_watching(*params, &block) - fsevents = new(*params, &block) - fsevents.create_stream - fsevents.start - fsevents - end - - # Creates a new FSEvents `watchdog` object. You can specify a list of paths to watch and options to control the - # behaviour of the watchdog. The block you pass serves as a callback when an event is generated on one of the - # specified paths. - # - # fsevents = FSEvents.new('/etc/passwd') { Mailer.send_mail("Someone touched the password file!") } - # fsevents.create_stream - # fsevents.start - # - # fsevents = FSEvents.new('/home/upload', :since => UploadWatcher.last_event_id) do |events| - # events.each do |event| - # UploadWatcher.last_event_id = event.id - # event.files.each do |file| - # UploadWatcher.logfile.append("#{file} was changed") - # end - # end - # end - # - # *:since: The service will report events that have happened after the supplied event ID. Never use 0 because that - # will cause every fsevent since the "beginning of time" to be reported. Use OSX::KFSEventStreamEventIdSinceNow - # if you want to receive events that have happened after this call. (Default: OSX::KFSEventStreamEventIdSinceNow). - # You can find the ID's passed with :since in the events passed to your block. - # *:latency: Number of seconds to wait until an FSEvent is reported, this allows the service to bundle events. (Default: 0.0) - # - # Please refer to the Cocoa documentation for the rest of the options. - def initialize(*params, &block) - raise ArgumentError, 'No callback block was specified.' unless block_given? - - options = params.last.kind_of?(Hash) ? params.pop : {} - @paths = params.flatten - - paths.each { |path| raise ArgumentError, "The specified path (#{path}) does not exist." unless File.exist?(path) } - - @allocator = options[:allocator] || OSX::KCFAllocatorDefault - @context = options[:context] || nil - @since = options[:since] || OSX::KFSEventStreamEventIdSinceNow - @latency = options[:latency] || 0.0 - @flags = options[:flags] || 0 - @stream = options[:stream] || nil - - @user_callback = block - @callback = Proc.new do |stream, client_callback_info, number_of_events, paths_pointer, event_flags, event_ids| - paths_pointer.regard_as('*') - events = [] - number_of_events.times {|i| events << Rucola::FSEvents::FSEvent.new(self, event_ids[i], paths_pointer[i]) } - @user_callback.call(events) - end - end - - # Create the stream. - # Raises a Rucola::FSEvents::StreamError if the stream could not be created. - def create_stream - @stream = OSX.FSEventStreamCreate(@allocator, @callback, @context, @paths, @since, @latency, @flags) - raise(StreamError, 'Unable to create FSEvents stream.') unless @stream - OSX.FSEventStreamScheduleWithRunLoop(@stream, OSX.CFRunLoopGetCurrent, OSX::KCFRunLoopDefaultMode) - end - - # Start the stream. - # Raises a Rucola::FSEvents::StreamError if the stream could not be started. - def start - raise(StreamError, 'Unable to start FSEvents stream.') unless OSX.FSEventStreamStart(@stream) - end - - # Stop the stream. - # You can resume it by calling `start` again. - def stop - OSX.FSEventStreamStop(@stream) - end - end -end diff --git a/lib/vendor/fssm/fssm/monitor.rb b/lib/vendor/fssm/fssm/monitor.rb deleted file mode 100644 index d7f7468d..00000000 --- a/lib/vendor/fssm/fssm/monitor.rb +++ /dev/null @@ -1,26 +0,0 @@ -class FSSM::Monitor - def initialize(options={}) - @options = options - @backend = FSSM::Backends::Default.new - end - - def path(*args, &block) - path = FSSM::Path.new(*args) - FSSM::Support.use_block(path, block) - - @backend.add_handler(FSSM::State::Directory.new(path)) - path - end - - def file(*args, &block) - path = FSSM::Path.new(*args) - FSSM::Support.use_block(path, block) - - @backend.add_handler(FSSM::State::File.new(path)) - path - end - - def run - @backend.run - end -end diff --git a/lib/vendor/fssm/fssm/path.rb b/lib/vendor/fssm/fssm/path.rb deleted file mode 100644 index 101dd103..00000000 --- a/lib/vendor/fssm/fssm/path.rb +++ /dev/null @@ -1,91 +0,0 @@ -class FSSM::Path - def initialize(path=nil, glob=nil, &block) - set_path(path || '.') - set_glob(glob || '**/*') - init_callbacks - - if block_given? - if block.arity == 1 - block.call(self) - else - self.instance_eval(&block) - end - end - end - - def to_s - @path.to_s - end - - def to_pathname - @path - end - - def glob(value=nil) - return @glob if value.nil? - set_glob(value) - end - - def create(callback_or_path=nil, &block) - callback_action(:create, (block_given? ? block : callback_or_path)) - end - - def update(callback_or_path=nil, &block) - callback_action(:update, (block_given? ? block : callback_or_path)) - end - - def delete(callback_or_path=nil, &block) - callback_action(:delete, (block_given? ? block : callback_or_path)) - end - - private - - def init_callbacks - do_nothing = lambda {|base, relative|} - @callbacks = Hash.new(do_nothing) - end - - def callback_action(type, arg=nil) - if arg.is_a?(Proc) - set_callback(type, arg) - elsif arg.nil? - get_callback(type) - else - run_callback(type, arg) - end - end - - def set_callback(type, arg) - raise ArgumentError, "Proc expected" unless arg.is_a?(Proc) - @callbacks[type] = arg - end - - def get_callback(type) - @callbacks[type] - end - - def run_callback(type, arg) - base, relative = split_path(arg) - - begin - @callbacks[type].call(base, relative) - rescue Exception => e - raise FSSM::CallbackError, "#{type} - #{base.join(relative)}: #{e.message}", e.backtrace - end - end - - def split_path(path) - path = FSSM::Pathname.for(path) - [@path, (path.relative? ? path : path.relative_path_from(@path))] - end - - def set_path(path) - path = FSSM::Pathname.for(path) - raise FSSM::FileNotFoundError, "No such file or directory - #{path}" unless path.exist? - @path = path.expand_path - end - - def set_glob(glob) - @glob = glob.is_a?(Array) ? glob : [glob] - end -end diff --git a/lib/vendor/fssm/fssm/pathname.rb b/lib/vendor/fssm/fssm/pathname.rb deleted file mode 100644 index 58396ac4..00000000 --- a/lib/vendor/fssm/fssm/pathname.rb +++ /dev/null @@ -1,502 +0,0 @@ -require 'fileutils' -require 'find' - -module FSSM - class Pathname < String - SYMLOOP_MAX = 8 - - ROOT = '/'.freeze - DOT = '.'.freeze - DOT_DOT = '..'.freeze - - class << self - def for(path) - path.is_a?(::FSSM::Pathname) ? path : new("#{path}") - end - end - - def initialize(path) - raise ArgumentError, "path cannot contain ASCII NULLs" if path =~ %r{\0} - super(path) - end - - def <=>(other) - self.tr('/', "\0").to_s <=> other.to_str.tr('/', "\0") - rescue NoMethodError - nil - end - - def ==(other) - left = self.cleanpath.tr('/', "\0").to_s - right = self.class.for(other).cleanpath.tr('/', "\0").to_s - - left == right - rescue NoMethodError - false - end - - def +(path) - dup << path - end - - def <<(path) - replace( join(path).cleanpath! ) - end - - def absolute? - self[0, 1].to_s == ROOT - end - - def ascend - parts = to_a - parts.length.downto(1) do |i| - yield self.class.join(parts[0, i]) - end - end - - def children - entries[2..-1] - end - - def cleanpath! - parts = to_a - final = [] - - parts.each do |part| - case part - when DOT then - next - when DOT_DOT then - case final.last - when ROOT then - next - when DOT_DOT then - final.push(DOT_DOT) - when nil then - final.push(DOT_DOT) - else - final.pop - end - else - final.push(part) - end - end - - replace(final.empty? ? DOT : self.class.join(*final)) - end - - def cleanpath - dup.cleanpath! - end - - def descend - parts = to_a - 1.upto(parts.length) { |i| yield self.class.join(parts[0, i]) } - end - - def dot? - self == DOT - end - - def dot_dot? - self == DOT_DOT - end - - def each_filename(&blk) - to_a.each(&blk) - end - - def mountpoint? - stat1 = self.lstat - stat2 = self.parent.lstat - - stat1.dev != stat2.dev || stat1.ino == stat2.ino - rescue Errno::ENOENT - false - end - - def parent - self + '..' - end - - def realpath - path = self - - SYMLOOP_MAX.times do - link = path.readlink - link = path.dirname + link if link.relative? - path = link - end - - raise Errno::ELOOP, self - rescue Errno::EINVAL - path.expand_path - end - - def relative? - !absolute? - end - - def relative_path_from(base) - base = self.class.for(base) - - raise ArgumentError, 'no relative path between a relative and absolute' if self.absolute? != base.absolute? - - return self if base.dot? - return self.class.new(DOT) if self == base - - base = base.cleanpath.to_a - dest = self.cleanpath.to_a - - while !dest.empty? && !base.empty? && dest[0] == base[0] - base.shift - dest.shift - end - - base.shift if base[0] == DOT - dest.shift if dest[0] == DOT - - raise ArgumentError, "base directory may not contain '#{DOT_DOT}'" if base.include?(DOT_DOT) - - path = base.fill(DOT_DOT) + dest - path = self.class.join(*path) - path = self.class.new(DOT) if path.empty? - - path - end - - def root? - !!(self =~ %r{^#{ROOT}+$}) - end - - def to_a - array = to_s.split(File::SEPARATOR) - array.delete('') - array.insert(0, ROOT) if absolute? - array - end - - alias segments to_a - - def to_path - self - end - - def to_s - "#{self}" - end - - alias to_str to_s - - def unlink - Dir.unlink(self) - true - rescue Errno::ENOTDIR - File.unlink(self) - true - end - end - - class Pathname - def self.[](pattern) - Dir[pattern].map! {|d| FSSM::Pathname.new(d) } - end - - def self.pwd - FSSM::Pathname.new(Dir.pwd) - end - - def entries - Dir.entries(self).map! {|e| FSSM::Pathname.new(e) } - end - - def mkdir(mode = 0777) - Dir.mkdir(self, mode) - end - - def opendir(&blk) - Dir.open(self, &blk) - end - - def rmdir - Dir.rmdir(self) - end - - def self.glob(pattern, flags = 0) - dirs = Dir.glob(pattern, flags) - dirs.map! {|path| FSSM::Pathname.new(path) } - - if block_given? - dirs.each {|dir| yield dir } - nil - else - dirs - end - end - - def glob(pattern, flags = 0, &block) - patterns = [pattern].flatten - patterns.map! {|p| self.class.glob(self.to_s + p, flags, &block) } - patterns.flatten - end - - def chdir - blk = lambda { yield self } if block_given? - Dir.chdir(self, &blk) - end - end - - class Pathname - def blockdev? - FileTest.blockdev?(self) - end - - def chardev? - FileTest.chardev?(self) - end - - def directory? - FileTest.directory?(self) - end - - def executable? - FileTest.executable?(self) - end - - def executable_real? - FileTest.executable_real?(self) - end - - def exists? - FileTest.exists?(self) - end - - def file? - FileTest.file?(self) - end - - def grpowned? - FileTest.grpowned?(self) - end - - def owned? - FileTest.owned?(self) - end - - def pipe? - FileTest.pipe?(self) - end - - def readable? - FileTest.readable?(self) - end - - def readable_real? - FileTest.readable_real?(self) - end - - def setgid? - FileTest.setgit?(self) - end - - def setuid? - FileTest.setuid?(self) - end - - def socket? - FileTest.socket?(self) - end - - def sticky? - FileTest.sticky?(self) - end - - def symlink? - FileTest.symlink?(self) - end - - def world_readable? - FileTest.world_readable?(self) - end - - def world_writable? - FileTest.world_writable?(self) - end - - def writable? - FileTest.writable?(self) - end - - def writable_real? - FileTest.writable_real?(self) - end - - def zero? - FileTest.zero?(self) - end - end - - class Pathname - def atime - File.atime(self) - end - - def ctime - File.ctime(self) - end - - def ftype - File.ftype(self) - end - - def lstat - File.lstat(self) - end - - def mtime - File.mtime(self) - end - - def stat - File.stat(self) - end - - def utime(atime, mtime) - File.utime(self, atime, mtime) - end - end - - class Pathname - def self.join(*parts) - last_part = FSSM::Pathname.new(parts.last) - return last_part if last_part.absolute? - FSSM::Pathname.new(File.join(*parts.reject {|p| p.empty? })) - end - - def basename - self.class.new(File.basename(self)) - end - - def chmod(mode) - File.chmod(mode, self) - end - - def chown(owner, group) - File.chown(owner, group, self) - end - - def dirname - self.class.new(File.dirname(self)) - end - - def expand_path(from = nil) - self.class.new(File.expand_path(self, from)) - end - - def extname - File.extname(self) - end - - def fnmatch?(pat, flags = 0) - File.fnmatch(pat, self, flags) - end - - def join(*parts) - self.class.join(self, *parts) - end - - def lchmod(mode) - File.lchmod(mode, self) - end - - def lchown(owner, group) - File.lchown(owner, group, self) - end - - def link(to) - File.link(self, to) - end - - def open(mode = 'r', perm = nil, &blk) - File.open(self, mode, perm, &blk) - end - - def readlink - self.class.new(File.readlink(self)) - end - - def rename(to) - File.rename(self, to) - replace(to) - end - - def size - File.size(self) - end - - def size? - File.size?(self) - end - - def split - File.split(self).map {|part| FSSM::Pathname.new(part) } - end - - def symlink(to) - File.symlink(self, to) - end - - def truncate - File.truncate(self) - end - end - - class Pathname - def mkpath - self.class.new(FileUtils.mkpath(self)) - end - - def rmtree - self.class.new(FileUtils.rmtree(self).first) - end - - def touch - self.class.new(FileUtils.touch(self).first) - end - end - - class Pathname - def each_line(sep = $/, &blk) - IO.foreach(self, sep, &blk) - end - - def read(len = nil, off = 0) - IO.read(self, len, off) - end - - def readlines(sep = $/) - IO.readlines(self, sep) - end - - def sysopen(mode = 'r', perm = nil) - IO.sysopen(self, mode, perm) - end - end - - class Pathname - def find - Find.find(self) {|path| yield FSSM::Pathname.new(path) } - end - end - - class Pathname - class << self - alias getwd pwd - end - - alias absolute expand_path - alias delete unlink - alias exist? exists? - alias fnmatch fnmatch? - end -end diff --git a/lib/vendor/fssm/fssm/state/directory.rb b/lib/vendor/fssm/fssm/state/directory.rb deleted file mode 100644 index de701e6a..00000000 --- a/lib/vendor/fssm/fssm/state/directory.rb +++ /dev/null @@ -1,57 +0,0 @@ -module FSSM::State - class Directory - attr_reader :path - - def initialize(path) - @path = path - @cache = FSSM::Tree::Cache.new - end - - def refresh(base=nil, skip_callbacks=false) - previous, current = recache(base || @path.to_pathname) - - unless skip_callbacks - deleted(previous, current) - created(previous, current) - modified(previous, current) - end - end - - private - - def created(previous, current) - (current.keys - previous.keys).each {|created| @path.create(created)} - end - - def deleted(previous, current) - (previous.keys - current.keys).each {|deleted| @path.delete(deleted)} - end - - def modified(previous, current) - (current.keys & previous.keys).each do |file| - @path.update(file) if (current[file] <=> previous[file]) != 0 - end - end - - def recache(base) - base = FSSM::Pathname.for(base) - previous = @cache.files - snapshot(base) - current = @cache.files - [previous, current] - end - - def snapshot(base) - base = FSSM::Pathname.for(base) - @cache.unset(base) - @path.glob.each {|glob| add_glob(base, glob)} - end - - def add_glob(base, glob) - FSSM::Pathname.glob(base.join(glob).to_s).each do |fn| - @cache.set(fn) - end - end - - end -end diff --git a/lib/vendor/fssm/fssm/state/file.rb b/lib/vendor/fssm/fssm/state/file.rb deleted file mode 100644 index ec601f81..00000000 --- a/lib/vendor/fssm/fssm/state/file.rb +++ /dev/null @@ -1,24 +0,0 @@ -module FSSM::State - class File - attr_reader :path - - def initialize(path) - @path = path - end - - def refresh(base=nil, skip_callbacks=false) - base ||= @path.to_pathname - used_to_exist, @exists = @exists, base.exists? - # this handles bad symlinks without failing. why handle bad symlinks at - # all? well, we could still be interested in their creation and deletion. - old_mtime, @mtime = @mtime, base.symlink? ? Time.at(0) : base.mtime if @exists - - unless skip_callbacks - @path.delete(@path.to_s) if used_to_exist && !@exists - @path.create(@path.to_s) if !used_to_exist && @exists - @path.update(@path.to_s) if used_to_exist && @exists && old_mtime != @mtime - end - end - - end -end diff --git a/lib/vendor/fssm/fssm/support.rb b/lib/vendor/fssm/fssm/support.rb deleted file mode 100644 index e70e793b..00000000 --- a/lib/vendor/fssm/fssm/support.rb +++ /dev/null @@ -1,63 +0,0 @@ -require 'rbconfig' - -module FSSM::Support - class << self - def backend - @@backend ||= case - when mac? && !jruby? && carbon_core? - 'FSEvents' - when linux? && rb_inotify? - 'Inotify' - else - 'Polling' - end - end - - def jruby? - defined?(JRUBY_VERSION) - end - - def mac? - Config::CONFIG['target_os'] =~ /darwin/i - end - - def linux? - Config::CONFIG['target_os'] =~ /linux/i - end - - def carbon_core? - begin - require 'osx/foundation' - OSX.require_framework '/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework' - true - rescue LoadError - STDERR.puts("Warning: Unable to load CarbonCore. FSEvents will be unavailable.") - false - end - end - - def rb_inotify? - found = begin - require 'rb-inotify' - if defined?(INotify::VERSION) - version = INotify::VERSION - version[0] > 0 || version[1] >= 6 - end - rescue LoadError - false - end - STDERR.puts("Warning: Unable to load rb-inotify >= 0.5.1. Inotify will be unavailable.") unless found - found - end - - def use_block(context, block) - return if block.nil? - if block.arity == 1 - block.call(context) - else - context.instance_eval(&block) - end - end - - end -end diff --git a/lib/vendor/fssm/fssm/tree.rb b/lib/vendor/fssm/fssm/tree.rb deleted file mode 100644 index 25b17be1..00000000 --- a/lib/vendor/fssm/fssm/tree.rb +++ /dev/null @@ -1,176 +0,0 @@ -module FSSM::Tree - module NodeBase - def initialize - @children = {} - end - - protected - - def child(segment) - @children["#{segment}"] - end - - def child!(segment) - (@children["#{segment}"] ||= Node.new) - end - - def has_child?(segment) - @children.has_key?("#{segment}") - end - - def remove_child(segment) - @children.delete("#{segment}") - end - - def remove_children - @children.clear - end - end - - module NodeEnumerable - include NodeBase - include Enumerable - - def each(prefix=nil, &block) - @children.each do |segment, node| - cprefix = prefix ? - FSSM::Pathname.for(prefix).join(segment) : - FSSM::Pathname.for(segment) - block.call([cprefix, node]) - node.each(cprefix, &block) - end - end - end - - module NodeInsertion - include NodeBase - - def unset(path) - key = key_segments(path) - - if key.empty? - remove_children - return nil - end - - segment = key.pop - node = descendant(key) - - return unless node - - node.remove_child(segment) - - nil - end - - def set(path) - node = descendant!(path) - node.from_path(path).mtime - end - - protected - - def key_segments(key) - return key if key.is_a?(Array) - FSSM::Pathname.for(key).segments - end - - def descendant(path) - recurse(path, false) - end - - def descendant!(path) - recurse(path, true) - end - - def recurse(key, create=false) - key = key_segments(key) - node = self - - until key.empty? - segment = key.shift - node = create ? node.child!(segment) : node.child(segment) - return nil unless node - end - - node - end - end - - module CacheDebug - def set(path) - FSSM.dbg("Cache#set(#{path})") - super - end - - def unset(path) - FSSM.dbg("Cache#unset(#{path})") - super - end - - def ftype(ft) - FSSM.dbg("Cache#ftype(#{ft})") - super - end - end - - class Node - include NodeBase - include NodeEnumerable - - attr_accessor :mtime - attr_accessor :ftype - - def <=>(other) - return unless other.is_a?(::FSSM::Tree::Node) - self.mtime <=> other.mtime - end - - def from_path(path) - path = FSSM::Pathname.for(path) - @ftype = path.ftype - # this handles bad symlinks without failing. why handle bad symlinks at - # all? well, we could still be interested in their creation and deletion. - @mtime = path.symlink? ? Time.at(0) : path.mtime - self - end - end - - class Cache - include NodeBase - include NodeEnumerable - include NodeInsertion - include CacheDebug if $DEBUG - - def set(path) - # all paths set from this level need to be absolute - # realpath will fail on broken links - path = FSSM::Pathname.for(path).expand_path - super(path) - end - - def files - ftype('file') - end - - def directories - ftype('directory') - end - - def links - ftype('link') - end - - alias symlinks links - - private - - def ftype(ft) - inject({}) do |hash, (path, node)| - hash["#{path}"] = node.mtime if node.ftype == ft - hash - end - end - end - -end diff --git a/spec/compass/commands/sprite_spec.rb b/spec/compass/commands/sprite_spec.rb new file mode 100644 index 00000000..6980dcc5 --- /dev/null +++ b/spec/compass/commands/sprite_spec.rb @@ -0,0 +1,55 @@ +require 'spec_helper' +require 'compass/commands' +require 'compass/exec' +require 'compass/commands/sprite' +describe Compass::Commands::Sprite do + def config_data + return <<-CONFIG + images_path = #{@images_tmp_path.inspect} + CONFIG + end + + def create_temp_cli_dir + directory = File.join(File.expand_path('../', __FILE__), 'test') + ::FileUtils.mkdir_p directory + @test_dir = directory + end + + def run_compass_with_options(options) + output = 'foo' + ::Dir.chdir @test_dir + %x{compass #{options.join(' ')}} + end + + def options_to_cli(options) + options.map.flatten! + end + + let(:test_dir) { @test_dir } + before :each do + @before_dir = ::Dir.pwd + create_temp_cli_dir + create_sprite_temp + File.open(File.join(@test_dir, 'config.rb'), 'w') do |f| + f << config_data + end + end + after :each do + ::Dir.chdir @before_dir + clean_up_sprites + if File.exists?(@test_dir) + ::FileUtils.rm_r @test_dir + end + end + + it "should create sprite file" do + run_compass_with_options(['sprite', "-f", "stylesheet.scss", "'#{@images_tmp_path}/*.png'"]).to_i.should == 0 + File.exists?(File.join(test_dir, 'stylesheet.scss')).should be_true + end + + it "should fail gracfuly when giving bad arguments" do + pending + end + + +end \ No newline at end of file diff --git a/spec/compass/sass_extensions/sprites/base_spec.rb b/spec/compass/sass_extensions/sprites/base_spec.rb new file mode 100644 index 00000000..6a086737 --- /dev/null +++ b/spec/compass/sass_extensions/sprites/base_spec.rb @@ -0,0 +1,57 @@ +require 'spec_helper' +describe Compass::SassExtensions::Sprites::Base do + + before :each do + @images_src_path = File.join(File.dirname(__FILE__), '..', '..', '..', 'test_project', 'public', 'images') + @images_tmp_path = File.join(File.dirname(__FILE__), '..', '..', '..', 'test_project', 'public', 'images-tmp') + FileUtils.cp_r @images_src_path, @images_tmp_path + config = Compass::Configuration::Data.new('config') + config.images_path = @images_tmp_path + Compass.add_configuration(config) + Compass.configure_sass_plugin! + #fix this eww + options = Compass.sass_engine_options.extend Compass::SassExtensions::Functions::Sprites::VariableReader + @map = Compass::SpriteMap.new("selectors/*.png", options) + @base = Compass::SassExtensions::Sprites::Base.new(@map.sprite_names.map{|n| "selectors/#{n}.png"}, @map.path, 'selectors', @map.sass_engine, @map.options) + end + + after :each do + FileUtils.rm_r @images_tmp_path + end + + subject { @base } + + its(:size) { should == [10,40] } + its(:sprite_names) { should == @map.sprite_names } + its(:image_filenames) { should == Dir["#{@images_tmp_path}/selectors/*.png"].sort } + its(:generation_required?) { should be_true } + its(:uniqueness_hash) { should == 'ef52c5c63a'} + its(:outdated?) { should be_true } + its(:filename) { should == File.join(@images_tmp_path, "#{@base.path}-#{@base.uniqueness_hash}.png")} + + it "should return the 'ten-by-ten' image" do + subject.image_for('ten-by-ten').name.should == 'ten-by-ten' + subject.image_for('ten-by-ten').should be_a Compass::SassExtensions::Sprites::Image + end + + %w(target hover active).each do |selector| + it "should have a #{selector}" do + subject.send(:"has_#{selector}?", 'ten-by-ten').should be_true + end + + it "should return #{selector} image class" do + subject.image_for('ten-by-ten').send(:"#{selector}").name.should == "ten-by-ten_#{selector}" + end + + end + context "#generate" do + before { @base.generate } + it "should generate sprite" do + File.exists?(@base.filename).should be_true + end + + its(:generation_required?) { should be_false } + its(:outdated?) { should be_false } + end + +end \ No newline at end of file diff --git a/spec/compass/sass_extensions/sprites/image_spec.rb b/spec/compass/sass_extensions/sprites/image_spec.rb new file mode 100644 index 00000000..f328a535 --- /dev/null +++ b/spec/compass/sass_extensions/sprites/image_spec.rb @@ -0,0 +1,161 @@ +require 'spec_helper' +require 'compass/sass_extensions/sprites/image' + +describe Compass::SassExtensions::Sprites::Image do + let(:sprite_filename) { 'squares/ten-by-ten.png' } + let(:sprite_path) { File.join(images_src_path, sprite_filename) } + let(:sprite_name) { File.basename(sprite_filename, '.png') } + let(:parent) do + mock + end + before do + parent.stubs(:image_for).with('ten-by-ten').returns(image) + parent.stubs(:image_for).with('ten-by-ten_hover').returns(hover_image) + end + let(:image) { self.class.describes.new(parent, File.join(sprite_filename), options)} + let(:hover_image) { self.class.describes.new(parent, File.join('selectors/ten-by-ten_hover.png'), options)} + let(:digest) { Digest::MD5.file(sprite_path).hexdigest } + subject { image } + + before { + file = StringIO.new("images_path = #{images_src_path.inspect}\n") + Compass.add_configuration(file, "sprite_config") + } + + describe '#initialize' do + its(:name) { should == sprite_name } + its(:file) { should == sprite_path } + its(:relative_file) { should == sprite_filename } + its(:width) { should == 10 } + its(:height) { should == 10 } + its(:digest) { should == digest } + its(:top) { should == 0 } + its(:left) { should == 0 } + end + + let(:get_var_expects) { nil } + let(:get_var_return) { nil } + + let(:options) { + options = mock + options.stubs(:get_var).with(anything).returns(nil) + options.stubs(:get_var).with(get_var_expects).returns(get_var_return) + options + } + + describe '#parent' do + context '_hover' do + subject { hover_image } + its(:parent) { should == image } + end + context 'no parent' do + subject { image } + its(:parent) { should be_nil } + end + end + + describe '#repeat' do + let(:type) { nil } + let(:get_var_return) { OpenStruct.new(:value => type) } + + context 'specific image' do + let(:type) { 'specific' } + let(:get_var_expects) { "#{sprite_name}-repeat" } + + its(:repeat) { should == type } + end + + context 'global' do + let(:type) { 'global' } + let(:get_var_expects) { 'repeat' } + + its(:repeat) { should == type } + end + + context 'default' do + let(:get_var_expects) { nil } + + its(:repeat) { should == "no-repeat" } + end + end + + describe '#position' do + let(:type) { nil } + let(:get_var_return) { type } + + context 'specific image' do + let(:type) { 'specific' } + let(:get_var_expects) { "#{sprite_name}-position" } + + its(:position) { should == type } + end + + context 'global' do + let(:type) { 'global' } + let(:get_var_expects) { 'position' } + + its(:position) { should == type } + end + + context 'default' do + let(:get_var_expects) { nil } + + its(:position) { should == Sass::Script::Number.new(0, ["px"]) } + end + end + + describe '#spacing' do + let(:type) { nil } + let(:get_var_return) { OpenStruct.new(:value => type) } + + context 'specific image' do + let(:type) { 'specific' } + let(:get_var_expects) { "#{sprite_name}-spacing" } + + its(:spacing) { should == type } + end + + context 'global' do + let(:type) { 'global' } + let(:get_var_expects) { 'spacing' } + + its(:spacing) { should == type } + end + + context 'default' do + let(:get_var_expects) { nil } + + its(:spacing) { should == Sass::Script::Number.new(0).value } + end + end + + describe '#offset' do + before { image.stubs(:position).returns(stub_position) } + + let(:offset) { 100 } + let(:stub_position) { + stub(:value => offset) + } + + context 'unitless' do + before { stub_position.stubs(:unitless?).returns(true) } + before { stub_position.stubs(:unit_str).returns('em') } + + its(:offset) { should == offset } + end + + context 'pixels' do + before { stub_position.stubs(:unitless?).returns(false) } + before { stub_position.stubs(:unit_str).returns('px') } + + its(:offset) { should == offset } + end + + context 'neither, use 0' do + before { stub_position.stubs(:unitless?).returns(false) } + before { stub_position.stubs(:unit_str).returns('em') } + + its(:offset) { should == 0 } + end + end +end diff --git a/spec/compass/sass_extensions/sprites/sprite_map_spec.rb b/spec/compass/sass_extensions/sprites/sprite_map_spec.rb new file mode 100644 index 00000000..a6eee9ea --- /dev/null +++ b/spec/compass/sass_extensions/sprites/sprite_map_spec.rb @@ -0,0 +1,54 @@ +require 'spec_helper' +require 'fakefs/spec_helpers' +require 'timecop' + +describe Compass::SpriteMap do + include FakeFS::SpecHelpers + + let(:sprite_map) { self.class.describes.new(uri, options) } + let(:options) { { :test => :test2 } } + + subject { sprite_map } + + let(:path) { 'path' } + let(:dir) { "dir/#{name}" } + let(:name) { 'subdir' } + + let(:sprite_path) { File.join(path, dir) } + let(:files) { (1..3).collect { |i| File.join(sprite_path, "#{i}.png") } } + let(:expanded_files) { files.collect { |file| File.expand_path(file) } } + + let(:configuration) { stub(:images_path => path) } + let(:mtime) { Time.now - 30 } + + before { + Compass.stubs(:configuration).returns(configuration) + + FileUtils.mkdir_p(sprite_path) + Timecop.freeze(mtime) do + files.each { |file| File.open(file, 'w') } + end + Timecop.return + } + + describe '#initialize' do + let(:uri) { 'dir/subdir/*.png' } + + its(:uri) { should == uri } + its(:path) { should == dir } + its(:name) { should == name } + + its(:files) { should == expanded_files } + + its(:sass_options) { should == options.merge(:filename => name, :syntax => :scss, :importer => sprite_map) } + + + it "should have a correct mtime" do + sprite_map.mtime(uri, subject.sass_options).should == mtime + end + + it "should have a test for the sass engine" do + pending 'sass' + end + end +end diff --git a/spec/compass/sass_extensions/sprites/sprites_spec.rb b/spec/compass/sass_extensions/sprites/sprites_spec.rb new file mode 100644 index 00000000..9246d8d3 --- /dev/null +++ b/spec/compass/sass_extensions/sprites/sprites_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' +require 'fakefs/spec_helpers' + +describe Compass::Sprites do +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0db4b936..9fee20ea 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,37 @@ $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) - require 'rubygems' require 'compass' require 'rspec' require 'rspec/autorun' +require 'mocha' + +module CompassGlobalInclude + class << self + def included(klass) + klass.instance_eval do + let(:images_src_path) { File.join(File.dirname(__FILE__), 'test_project', 'public', 'images') } + end + end + end +end + +module CompassSpriteHelpers + def create_sprite_temp + ::FileUtils.cp_r @images_src_path, @images_tmp_path + end + + def clean_up_sprites + ::FileUtils.rm_r @images_tmp_path + end +end + +RSpec.configure do |config| + config.include(CompassGlobalInclude) + config.include(CompassSpriteHelpers) + config.before :each do + @images_src_path = File.join(File.dirname(__FILE__), 'test_project', 'public', 'images') + @images_tmp_path = File.join(File.dirname(__FILE__), 'test_project', 'public', 'images-tmp') + end + config.mock_with :mocha +end \ No newline at end of file diff --git a/spec/sprites_spec.rb b/spec/sprites_spec.rb index ee26a915..2b39c8a3 100644 --- a/spec/sprites_spec.rb +++ b/spec/sprites_spec.rb @@ -1,19 +1,17 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper') -require "compass/sprites" require 'digest/md5' describe Compass::Sprites do - + before :each do - @images_src_path = File.join(File.dirname(__FILE__), 'test_project', 'public', 'images') - @images_tmp_path = File.join(File.dirname(__FILE__), 'test_project', 'public', 'images-tmp') - FileUtils.cp_r @images_src_path, @images_tmp_path - Compass.configuration.images_path = @images_tmp_path + create_sprite_temp + file = StringIO.new("images_path = #{@images_tmp_path.inspect}\n") + Compass.add_configuration(file, "sprite_config") Compass.configure_sass_plugin! end after :each do - FileUtils.rm_r @images_tmp_path + clean_up_sprites end def map_location(file) @@ -29,7 +27,7 @@ describe Compass::Sprites do md5.update IO.read(map_location(file)) md5.hexdigest end - + def render(scss) scss = %Q(@import "compass"; #{scss}) options = Compass.sass_engine_options @@ -40,9 +38,34 @@ describe Compass::Sprites do # reformat to fit result of heredoc: " #{css.gsub('@charset "UTF-8";', '').gsub(/\n/, "\n ").strip}\n" end - - # DEFAULT USAGE: + #Callbacks + describe 'callbacks' do + it "should fire on_sprite_saved" do + saved = false + path = nil + Compass.configuration.on_sprite_saved {|filepath| path = filepath; saved = true } + render <<-SCSS + @import "squares/*.png"; + @include all-squares-sprites; + SCSS + saved.should eq true + path.should be_kind_of String + end + it "should fire on_sprite_generated" do + saved = false + sprite_data = nil + Compass.configuration.on_sprite_generated {|data| sprite_data = data; saved = true } + render <<-SCSS + @import "squares/*.png"; + @include all-squares-sprites; + SCSS + sprite_data.should be_kind_of ChunkyPNG::Image + saved.should eq true + end + end + + # DEFAULT USAGE: it "should generate sprite classes" do css = render <<-SCSS @import "squares/*.png"; @@ -62,7 +85,7 @@ describe Compass::Sprites do } CSS image_size('squares-*.png').should == [20, 30] - image_md5('squares-*.png').should == 'e8cd71d546aae6951ea44cb01af35820' + image_md5('squares-*.png').should == 'fcc93d7b279c2ad6898fbca49cbd01e1' end it "should generate sprite classes with dimensions" do @@ -90,15 +113,15 @@ describe Compass::Sprites do CSS image_size('squares-*.png').should == [20, 30] end - + it "should provide sprite mixin" do css = render <<-SCSS @import "squares/*.png"; - + .cubicle { @include squares-sprite("ten-by-ten"); } - + .large-cube { @include squares-sprite("twenty-by-twenty", true); } @@ -120,9 +143,9 @@ describe Compass::Sprites do CSS image_size('squares-*.png').should == [20, 30] end - + # CUSTOMIZATIONS: - + it "should be possible to change the base class" do css = render <<-SCSS $squares-sprite-base-class: ".circles"; @@ -135,7 +158,7 @@ describe Compass::Sprites do CSS image_size('squares-*.png').should == [20, 30] end - + it "should calculate the spacing between images but not before first image" do css = render <<-SCSS $squares-ten-by-ten-spacing: 33px; @@ -157,7 +180,7 @@ describe Compass::Sprites do CSS image_size('squares-*.png').should == [20, 63] end - + it "should calculate the spacing between images" do css = render <<-SCSS $squares-twenty-by-twenty-spacing: 33px; @@ -179,7 +202,7 @@ describe Compass::Sprites do CSS image_size('squares-*.png').should == [20, 63] end - + it "should calculate the maximum spacing between images" do css = render <<-SCSS $squares-ten-by-ten-spacing: 44px; @@ -202,7 +225,7 @@ describe Compass::Sprites do CSS image_size('squares-*.png').should == [20, 74] end - + it "should calculate the maximum spacing between images in reversed order" do css = render <<-SCSS $squares-ten-by-ten-spacing: 33px; @@ -225,7 +248,7 @@ describe Compass::Sprites do CSS image_size('squares-*.png').should == [20, 74] end - + it "should calculate the default spacing between images" do css = render <<-SCSS $squares-spacing: 22px; @@ -247,22 +270,22 @@ describe Compass::Sprites do CSS image_size('squares-*.png').should == [20, 52] end - + it "should use position adjustments in functions" do css = render <<-SCSS $squares: sprite-map("squares/*.png", $position: 100%); .squares-sprite { background: $squares no-repeat; } - + .adjusted-percentage { background-position: sprite-position($squares, ten-by-ten, 100%); } - + .adjusted-px-1 { background-position: sprite-position($squares, ten-by-ten, 4px); } - + .adjusted-px-2 { background-position: sprite-position($squares, twenty-by-twenty, -3px, 2px); } @@ -285,22 +308,22 @@ describe Compass::Sprites do } CSS image_size('squares-*.png').should == [20, 30] - image_md5('squares-*.png').should == 'b61700e6d402d9df5f3820b73479f371' + image_md5('squares-*.png').should == '652b67f5e9092520d6f26caae7e18012' end - + it "should use position adjustments in mixins" do css = render <<-SCSS $squares-position: 100%; @import "squares/*.png"; - + .adjusted-percentage { @include squares-sprite("ten-by-ten", $offset-x: 100%); } - + .adjusted-px-1 { @include squares-sprite("ten-by-ten", $offset-x: 4px); } - + .adjusted-px-2 { @include squares-sprite("twenty-by-twenty", $offset-x: -3px, $offset-y: 2px); } @@ -323,9 +346,9 @@ describe Compass::Sprites do } CSS image_size('squares-*.png').should == [20, 30] - image_md5('squares-*.png').should == 'b61700e6d402d9df5f3820b73479f371' + image_md5('squares-*.png').should == '652b67f5e9092520d6f26caae7e18012' end - + it "should repeat the image" do css = render <<-SCSS $squares-repeat: repeat; @@ -346,7 +369,7 @@ describe Compass::Sprites do } CSS image_size('squares-*.png').should == [20, 30] - image_md5('squares-*.png').should == '0187306f3858136feee87d3017e7f307' + image_md5('squares-*.png').should == '94abae8440f1b58617f52920b70aaed2' end it "should allow the position of a sprite to be specified in absolute pixels" do @@ -370,9 +393,9 @@ describe Compass::Sprites do } CSS image_size('squares-*.png').should == [30, 30] - image_md5('squares-*.png').should == '262766d3e342f72b052f5708da6a1bf3' + image_md5('squares-*.png').should == '2fb19ef9c83018c93c6f147af3a56cb2' end - + it "should provide a nice errors for lemonade's old users" do proc do render <<-SCSS @@ -393,7 +416,7 @@ describe Compass::Sprites do proc do render <<-SCSS @import "squares/*.png"; - + .squares { background: sprite-position("squares/twenty-by-twenty.png") no-repeat; } @@ -401,7 +424,7 @@ describe Compass::Sprites do end.should raise_error Sass::SyntaxError, %q(The first argument to sprite-position() must be a sprite map. See http://beta.compass-style.org/help/tutorials/spriting/ for more information.) end - + it "should work even if @import is missing" do actual_css = render <<-SCSS .squares { @@ -415,4 +438,134 @@ describe Compass::Sprites do CSS end -end \ No newline at end of file + it "should calculate corret sprite demsions when givin spacing via issue#253" do + css = render <<-SCSS + $squares-spacing: 10px; + @import "squares/*.png"; + .foo { + @include sprite-background-position($squares-sprites, "twenty-by-twenty"); + } + .bar { + @include sprite-background-position($squares-sprites, "ten-by-ten"); + } + SCSS + image_size('squares-*.png').should == [20, 40] + css.should == <<-CSS + .squares-sprite { + background: url('/squares-e3c68372d9.png') no-repeat; + } + + .foo { + background-position: 0 -20px; + } + + .bar { + background-position: 0 0; + } + CSS + end + + it "should render corret sprite with css selectors via issue#248" do + css = render <<-SCSS + @import "selectors/*.png"; + @include all-selectors-sprites; + SCSS + css.should == <<-CSS + .selectors-sprite, .selectors-ten-by-ten { + background: url('/selectors-edfef809e2.png') no-repeat; + } + + .selectors-ten-by-ten { + background-position: 0 0; + } + .selectors-ten-by-ten:hover, .selectors-ten-by-ten.ten-by-ten_hover, .selectors-ten-by-ten.ten-by-ten-hover { + background-position: 0 -20px; + } + .selectors-ten-by-ten:target, .selectors-ten-by-ten.ten-by-ten_target, .selectors-ten-by-ten.ten-by-ten-target { + background-position: 0 -30px; + } + .selectors-ten-by-ten:active, .selectors-ten-by-ten.ten-by-ten_active, .selectors-ten-by-ten.ten-by-ten-active { + background-position: 0 -10px; + } + CSS + end + + it "should render corret sprite with css selectors via magic mixin" do + css = render <<-SCSS + @import "selectors/*.png"; + a { + @include selectors-sprite(ten-by-ten) + } + SCSS + css.should == <<-CSS + .selectors-sprite, a { + background: url('/selectors-edfef809e2.png') no-repeat; + } + + a { + background-position: 0 0; + } + a:hover, a.ten-by-ten_hover, a.ten-by-ten-hover { + background-position: 0 -20px; + } + a:target, a.ten-by-ten_target, a.ten-by-ten-target { + background-position: 0 -30px; + } + a:active, a.ten-by-ten_active, a.ten-by-ten-active { + background-position: 0 -10px; + } + CSS + end + + it "should not render corret sprite with css selectors via magic mixin" do + css = render <<-SCSS + @import "selectors/*.png"; + a { + $disable-magic-sprite-selectors:true; + @include selectors-sprite(ten-by-ten) + } + SCSS + css.should == <<-CSS + .selectors-sprite, a { + background: url('/selectors-edfef809e2.png') no-repeat; + } + + a { + background-position: 0 0; + } + CSS + end + + it "should raise error on filenames that are not valid sass syntax" do + lambda do + render <<-SCSS + @import "prefix/*.png"; + a { + @include squares-sprite(20-by-20); + } + SCSS + end.should raise_error Compass::Error + end + + it "should generate sprite with bad repeat-x dimensions" do + css = render <<-SCSS + $ko-starbg26x27-repeat: repeat-x; + @import "ko/*.png"; + @include all-ko-sprites; + SCSS + css.should == <<-CSS + .ko-sprite, .ko-default_background, .ko-starbg26x27 { + background: url('/ko-cc3f80660d.png') no-repeat; + } + + .ko-default_background { + background-position: 0 0; + } + + .ko-starbg26x27 { + background-position: 0 -128px; + } + CSS + end + +end diff --git a/spec/test_project/public/images/ko/default_background.png b/spec/test_project/public/images/ko/default_background.png new file mode 100644 index 00000000..b98cd7f9 Binary files /dev/null and b/spec/test_project/public/images/ko/default_background.png differ diff --git a/spec/test_project/public/images/ko/starbg26x27.png b/spec/test_project/public/images/ko/starbg26x27.png new file mode 100755 index 00000000..48dee0db Binary files /dev/null and b/spec/test_project/public/images/ko/starbg26x27.png differ diff --git a/spec/test_project/public/images/prefix/20-by-20.png b/spec/test_project/public/images/prefix/20-by-20.png new file mode 100644 index 00000000..4e5e297f Binary files /dev/null and b/spec/test_project/public/images/prefix/20-by-20.png differ diff --git a/spec/test_project/public/images/prefix/ten-by-ten.png b/spec/test_project/public/images/prefix/ten-by-ten.png new file mode 100644 index 00000000..c0ae53cc Binary files /dev/null and b/spec/test_project/public/images/prefix/ten-by-ten.png differ diff --git a/spec/test_project/public/images/selectors/ten-by-ten.png b/spec/test_project/public/images/selectors/ten-by-ten.png new file mode 100644 index 00000000..c0ae53cc Binary files /dev/null and b/spec/test_project/public/images/selectors/ten-by-ten.png differ diff --git a/spec/test_project/public/images/selectors/ten-by-ten_active.png b/spec/test_project/public/images/selectors/ten-by-ten_active.png new file mode 100644 index 00000000..c0ae53cc Binary files /dev/null and b/spec/test_project/public/images/selectors/ten-by-ten_active.png differ diff --git a/spec/test_project/public/images/selectors/ten-by-ten_hover.png b/spec/test_project/public/images/selectors/ten-by-ten_hover.png new file mode 100644 index 00000000..c0ae53cc Binary files /dev/null and b/spec/test_project/public/images/selectors/ten-by-ten_hover.png differ diff --git a/spec/test_project/public/images/selectors/ten-by-ten_target.png b/spec/test_project/public/images/selectors/ten-by-ten_target.png new file mode 100644 index 00000000..c0ae53cc Binary files /dev/null and b/spec/test_project/public/images/selectors/ten-by-ten_target.png differ diff --git a/test/compass_test.rb b/test/compass_test.rb index f86f94c3..02920954 100644 --- a/test/compass_test.rb +++ b/test/compass_test.rb @@ -20,6 +20,29 @@ class CompassTest < Test::Unit::TestCase end end + def test_on_stylesheet_saved_callback + saved = false + path = nil + config = nil + before_compile = Proc.new do |config| + config.on_stylesheet_saved {|filepath| path = filepath; saved = true } + end + within_project(:blueprint, before_compile) + assert saved, "Stylesheet callback didn't get called" + assert path.is_a?(String), "Path is not a string. Got: #{path.class.name}" + end + + # no project with errors exists to test aginst - leep of FAITH! + # *chriseppstein flogs himself* + # def test_on_stylesheet_error_callback + # error = false + # file = nil + # Compass.configuration.on_stylesheet_error {|filename, message| file = filename; error = true } + # within_project(:error) { } #requires a block but we don't need to pass anything - sdavis + # assert error, "Project did not throw a compile error" + # assert file.is_a?(String), "Filename was not a string" + # end + def test_empty_project # With no sass files, we should have no css files. within_project(:empty) do |proj| @@ -102,22 +125,27 @@ private end end - def within_project(project_name) + def within_project(project_name, config_block = nil) @current_project = project_name Compass.add_configuration(configuration_file(project_name)) if File.exists?(configuration_file(project_name)) Compass.configuration.project_path = project_path(project_name) Compass.configuration.environment = :production args = Compass.configuration.to_compiler_arguments(:logger => Compass::NullLogger.new) + + if config_block + config_block.call(Compass.configuration) + end + if Compass.configuration.sass_path && File.exists?(Compass.configuration.sass_path) compiler = Compass::Compiler.new *args compiler.run end - yield Compass.configuration + yield Compass.configuration if block_given? rescue - save_output(project_name) + save_output(project_name) raise end - + def each_css_file(dir, &block) Dir.glob("#{dir}/**/*.css").each(&block) end @@ -145,15 +173,15 @@ private def tempfile_path(project_name) File.join(project_path(project_name), "tmp") end - + def template_path(project_name) File.join(project_path(project_name), "sass") end - + def result_path(project_name) File.join(project_path(project_name), "css") end - + def save_path(project_name) File.join(project_path(project_name), "saved") end diff --git a/test/configuration_test.rb b/test/configuration_test.rb index 4d605089..419e5b27 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -87,10 +87,16 @@ class ConfigurationTest < Test::Unit::TestCase 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].find{|s,c| s == "/path/to/my/framework"}[1] - assert_equal "/home/chris/my_compass_project/css/foo", Compass.configuration.to_sass_plugin_options[:template_location].find{|s,c| s == "/home/chris/my_compass_project/../foo"}[1] + engine_opts = Compass.configuration.to_sass_engine_options + + load_paths = load_paths_as_strings(engine_opts[:load_paths]) + + plugin_opts = Compass.configuration.to_sass_plugin_options + + assert load_paths.include?("/home/chris/my_compass_project/../foo") + assert load_paths.include?("/path/to/my/framework"), load_paths.inspect + assert_equal "/home/chris/my_compass_project/css/framework", plugin_opts[:template_location].find{|s,c| s == "/path/to/my/framework"}[1] + assert_equal "/home/chris/my_compass_project/css/foo", plugin_opts[:template_location].find{|s,c| s == "/home/chris/my_compass_project/../foo"}[1] expected_serialization = < body { + font-size: 14px; } + +.small { + font-size: 0.857em; + line-height: 1.333em; } + +.padded { + margin-top: 1.143em; + padding-top: 1.143em; + padding-bottom: 1.143em; + margin-bottom: 1.143em; } + +.small-padded { + font-size: 0.857em; + line-height: 1.333em; + margin-top: 1.333em; + padding-top: 1.333em; + padding-bottom: 1.333em; + margin-bottom: 1.333em; } + +.borders { + border-top-style: solid; + border-top-width: 0.071em; + padding-top: 1.071em; + border-bottom-style: solid; + border-bottom-width: 0.071em; + padding-bottom: 1.071em; } + +.large-borders { + font-size: 1.714em; + line-height: 2em; + border-top-style: solid; + border-top-width: 0.25em; + padding-top: 0.417em; + border-bottom-style: solid; + border-bottom-width: 0.25em; + padding-bottom: 0.417em; } diff --git a/test/fixtures/stylesheets/compass/images/flag-03c3b29b35.png b/test/fixtures/stylesheets/compass/images/flag-03c3b29b35.png new file mode 100644 index 00000000..3ec1e90d Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag-03c3b29b35.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ad.png b/test/fixtures/stylesheets/compass/images/flag/ad.png new file mode 100644 index 00000000..1904b78f Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ad.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ae.png b/test/fixtures/stylesheets/compass/images/flag/ae.png new file mode 100644 index 00000000..c53e2f05 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ae.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/af.png b/test/fixtures/stylesheets/compass/images/flag/af.png new file mode 100644 index 00000000..3e628e75 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/af.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ag.png b/test/fixtures/stylesheets/compass/images/flag/ag.png new file mode 100644 index 00000000..29d0e184 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ag.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ai.png b/test/fixtures/stylesheets/compass/images/flag/ai.png new file mode 100644 index 00000000..f36c86f9 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ai.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/al.png b/test/fixtures/stylesheets/compass/images/flag/al.png new file mode 100644 index 00000000..c21fe404 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/al.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/am.png b/test/fixtures/stylesheets/compass/images/flag/am.png new file mode 100644 index 00000000..25af545b Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/am.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/an.png b/test/fixtures/stylesheets/compass/images/flag/an.png new file mode 100644 index 00000000..0a985185 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/an.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ao.png b/test/fixtures/stylesheets/compass/images/flag/ao.png new file mode 100644 index 00000000..a44327fd Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ao.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ar.png b/test/fixtures/stylesheets/compass/images/flag/ar.png new file mode 100644 index 00000000..d5bf27c4 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ar.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/as.png b/test/fixtures/stylesheets/compass/images/flag/as.png new file mode 100644 index 00000000..32222843 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/as.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/at.png b/test/fixtures/stylesheets/compass/images/flag/at.png new file mode 100644 index 00000000..247acd2c Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/at.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/au.png b/test/fixtures/stylesheets/compass/images/flag/au.png new file mode 100644 index 00000000..6268b886 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/au.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/aw.png b/test/fixtures/stylesheets/compass/images/flag/aw.png new file mode 100644 index 00000000..a7fbdc7b Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/aw.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ax.png b/test/fixtures/stylesheets/compass/images/flag/ax.png new file mode 100644 index 00000000..a099b4f3 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ax.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/az.png b/test/fixtures/stylesheets/compass/images/flag/az.png new file mode 100644 index 00000000..60bea4eb Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/az.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ba.png b/test/fixtures/stylesheets/compass/images/flag/ba.png new file mode 100644 index 00000000..5b1ebbe9 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ba.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bb.png b/test/fixtures/stylesheets/compass/images/flag/bb.png new file mode 100644 index 00000000..c2faae67 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bb.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bd.png b/test/fixtures/stylesheets/compass/images/flag/bd.png new file mode 100644 index 00000000..34a6c33c Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bd.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/be.png b/test/fixtures/stylesheets/compass/images/flag/be.png new file mode 100644 index 00000000..6eb9b6a4 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/be.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bf.png b/test/fixtures/stylesheets/compass/images/flag/bf.png new file mode 100644 index 00000000..7a4b5893 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bf.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bg.png b/test/fixtures/stylesheets/compass/images/flag/bg.png new file mode 100644 index 00000000..c30d8856 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bg.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bh.png b/test/fixtures/stylesheets/compass/images/flag/bh.png new file mode 100644 index 00000000..d559ce08 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bh.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bi.png b/test/fixtures/stylesheets/compass/images/flag/bi.png new file mode 100644 index 00000000..622ed1cd Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bi.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bj.png b/test/fixtures/stylesheets/compass/images/flag/bj.png new file mode 100644 index 00000000..17398e41 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bj.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bm.png b/test/fixtures/stylesheets/compass/images/flag/bm.png new file mode 100644 index 00000000..325f631b Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bm.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bn.png b/test/fixtures/stylesheets/compass/images/flag/bn.png new file mode 100644 index 00000000..63a008a8 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bn.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bo.png b/test/fixtures/stylesheets/compass/images/flag/bo.png new file mode 100644 index 00000000..e56d84b2 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bo.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/br.png b/test/fixtures/stylesheets/compass/images/flag/br.png new file mode 100644 index 00000000..2c8b73e5 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/br.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bs.png b/test/fixtures/stylesheets/compass/images/flag/bs.png new file mode 100644 index 00000000..ffc2fa81 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bs.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bt.png b/test/fixtures/stylesheets/compass/images/flag/bt.png new file mode 100644 index 00000000..a8702183 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bt.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bv.png b/test/fixtures/stylesheets/compass/images/flag/bv.png new file mode 100644 index 00000000..29aaa169 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bv.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bw.png b/test/fixtures/stylesheets/compass/images/flag/bw.png new file mode 100644 index 00000000..b273c857 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bw.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/by.png b/test/fixtures/stylesheets/compass/images/flag/by.png new file mode 100644 index 00000000..19d06f17 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/by.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/bz.png b/test/fixtures/stylesheets/compass/images/flag/bz.png new file mode 100644 index 00000000..8f6eead8 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/bz.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ca.png b/test/fixtures/stylesheets/compass/images/flag/ca.png new file mode 100644 index 00000000..fa22e45a Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ca.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/catalonia.png b/test/fixtures/stylesheets/compass/images/flag/catalonia.png new file mode 100644 index 00000000..85082e1a Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/catalonia.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/cc.png b/test/fixtures/stylesheets/compass/images/flag/cc.png new file mode 100644 index 00000000..ecf92ff0 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/cc.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/cd.png b/test/fixtures/stylesheets/compass/images/flag/cd.png new file mode 100644 index 00000000..369769c3 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/cd.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/cf.png b/test/fixtures/stylesheets/compass/images/flag/cf.png new file mode 100644 index 00000000..380455ac Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/cf.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/cg.png b/test/fixtures/stylesheets/compass/images/flag/cg.png new file mode 100644 index 00000000..684ce2dc Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/cg.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ch.png b/test/fixtures/stylesheets/compass/images/flag/ch.png new file mode 100644 index 00000000..2c16c9c5 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ch.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ci.png b/test/fixtures/stylesheets/compass/images/flag/ci.png new file mode 100644 index 00000000..4b55ff8a Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ci.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ck.png b/test/fixtures/stylesheets/compass/images/flag/ck.png new file mode 100644 index 00000000..5195a330 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ck.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/cl.png b/test/fixtures/stylesheets/compass/images/flag/cl.png new file mode 100644 index 00000000..88500b56 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/cl.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/cm.png b/test/fixtures/stylesheets/compass/images/flag/cm.png new file mode 100644 index 00000000..a3208d65 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/cm.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/cn.png b/test/fixtures/stylesheets/compass/images/flag/cn.png new file mode 100644 index 00000000..dec0f326 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/cn.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/co.png b/test/fixtures/stylesheets/compass/images/flag/co.png new file mode 100644 index 00000000..8584ca4c Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/co.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/cr.png b/test/fixtures/stylesheets/compass/images/flag/cr.png new file mode 100644 index 00000000..cd207131 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/cr.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/cs.png b/test/fixtures/stylesheets/compass/images/flag/cs.png new file mode 100644 index 00000000..fbc2cce1 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/cs.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/cu.png b/test/fixtures/stylesheets/compass/images/flag/cu.png new file mode 100644 index 00000000..40f26a67 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/cu.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/cv.png b/test/fixtures/stylesheets/compass/images/flag/cv.png new file mode 100644 index 00000000..1e7dcd50 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/cv.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/cx.png b/test/fixtures/stylesheets/compass/images/flag/cx.png new file mode 100644 index 00000000..40bf9f3f Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/cx.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/cy.png b/test/fixtures/stylesheets/compass/images/flag/cy.png new file mode 100644 index 00000000..c975f51a Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/cy.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/cz.png b/test/fixtures/stylesheets/compass/images/flag/cz.png new file mode 100644 index 00000000..780400b4 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/cz.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/de.png b/test/fixtures/stylesheets/compass/images/flag/de.png new file mode 100644 index 00000000..25aa1a27 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/de.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/dj.png b/test/fixtures/stylesheets/compass/images/flag/dj.png new file mode 100644 index 00000000..55668b12 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/dj.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/dk.png b/test/fixtures/stylesheets/compass/images/flag/dk.png new file mode 100644 index 00000000..5f660619 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/dk.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/dm.png b/test/fixtures/stylesheets/compass/images/flag/dm.png new file mode 100644 index 00000000..71ca1d8a Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/dm.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/do.png b/test/fixtures/stylesheets/compass/images/flag/do.png new file mode 100644 index 00000000..7b815041 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/do.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/dz.png b/test/fixtures/stylesheets/compass/images/flag/dz.png new file mode 100644 index 00000000..7864df5c Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/dz.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ec.png b/test/fixtures/stylesheets/compass/images/flag/ec.png new file mode 100644 index 00000000..700cc5c4 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ec.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ee.png b/test/fixtures/stylesheets/compass/images/flag/ee.png new file mode 100644 index 00000000..ae4e1dbf Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ee.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/eg.png b/test/fixtures/stylesheets/compass/images/flag/eg.png new file mode 100644 index 00000000..4cbfe4cc Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/eg.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/eh.png b/test/fixtures/stylesheets/compass/images/flag/eh.png new file mode 100644 index 00000000..cbd6b1e0 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/eh.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/england.png b/test/fixtures/stylesheets/compass/images/flag/england.png new file mode 100644 index 00000000..65998bcf Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/england.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/er.png b/test/fixtures/stylesheets/compass/images/flag/er.png new file mode 100644 index 00000000..9e48d4c5 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/er.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/es.png b/test/fixtures/stylesheets/compass/images/flag/es.png new file mode 100644 index 00000000..98a61873 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/es.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/et.png b/test/fixtures/stylesheets/compass/images/flag/et.png new file mode 100644 index 00000000..c010f6c8 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/et.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/europeanunion.png b/test/fixtures/stylesheets/compass/images/flag/europeanunion.png new file mode 100644 index 00000000..ff4b8b4a Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/europeanunion.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/fam.png b/test/fixtures/stylesheets/compass/images/flag/fam.png new file mode 100644 index 00000000..bae6182a Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/fam.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/fi.png b/test/fixtures/stylesheets/compass/images/flag/fi.png new file mode 100644 index 00000000..93c61230 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/fi.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/fj.png b/test/fixtures/stylesheets/compass/images/flag/fj.png new file mode 100644 index 00000000..4334dac1 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/fj.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/fk.png b/test/fixtures/stylesheets/compass/images/flag/fk.png new file mode 100644 index 00000000..3a850fb1 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/fk.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/fm.png b/test/fixtures/stylesheets/compass/images/flag/fm.png new file mode 100644 index 00000000..9a598a63 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/fm.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/fo.png b/test/fixtures/stylesheets/compass/images/flag/fo.png new file mode 100644 index 00000000..6db42e53 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/fo.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/fr.png b/test/fixtures/stylesheets/compass/images/flag/fr.png new file mode 100644 index 00000000..156c8932 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/fr.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ga.png b/test/fixtures/stylesheets/compass/images/flag/ga.png new file mode 100644 index 00000000..ee3ff2dc Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ga.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gb.png b/test/fixtures/stylesheets/compass/images/flag/gb.png new file mode 100644 index 00000000..29c8cd11 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gb.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gd.png b/test/fixtures/stylesheets/compass/images/flag/gd.png new file mode 100644 index 00000000..eb2d526f Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gd.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ge.png b/test/fixtures/stylesheets/compass/images/flag/ge.png new file mode 100644 index 00000000..98bedf24 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ge.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gf.png b/test/fixtures/stylesheets/compass/images/flag/gf.png new file mode 100644 index 00000000..156c8932 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gf.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gh.png b/test/fixtures/stylesheets/compass/images/flag/gh.png new file mode 100644 index 00000000..073874c9 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gh.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gi.png b/test/fixtures/stylesheets/compass/images/flag/gi.png new file mode 100644 index 00000000..b1b46d35 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gi.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gl.png b/test/fixtures/stylesheets/compass/images/flag/gl.png new file mode 100644 index 00000000..19cc57c9 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gl.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gm.png b/test/fixtures/stylesheets/compass/images/flag/gm.png new file mode 100644 index 00000000..88289320 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gm.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gn.png b/test/fixtures/stylesheets/compass/images/flag/gn.png new file mode 100644 index 00000000..b379ada3 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gn.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gp.png b/test/fixtures/stylesheets/compass/images/flag/gp.png new file mode 100644 index 00000000..902edaff Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gp.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gq.png b/test/fixtures/stylesheets/compass/images/flag/gq.png new file mode 100644 index 00000000..8a6e6dc0 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gq.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gr.png b/test/fixtures/stylesheets/compass/images/flag/gr.png new file mode 100644 index 00000000..ee698841 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gr.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gs.png b/test/fixtures/stylesheets/compass/images/flag/gs.png new file mode 100644 index 00000000..1ef34a85 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gs.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gt.png b/test/fixtures/stylesheets/compass/images/flag/gt.png new file mode 100644 index 00000000..e45bb09b Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gt.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gu.png b/test/fixtures/stylesheets/compass/images/flag/gu.png new file mode 100644 index 00000000..0bc97ca0 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gu.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gw.png b/test/fixtures/stylesheets/compass/images/flag/gw.png new file mode 100644 index 00000000..77100c30 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gw.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/gy.png b/test/fixtures/stylesheets/compass/images/flag/gy.png new file mode 100644 index 00000000..507e00fe Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/gy.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/hk.png b/test/fixtures/stylesheets/compass/images/flag/hk.png new file mode 100644 index 00000000..351b5e8d Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/hk.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/hm.png b/test/fixtures/stylesheets/compass/images/flag/hm.png new file mode 100644 index 00000000..98180040 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/hm.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/hn.png b/test/fixtures/stylesheets/compass/images/flag/hn.png new file mode 100644 index 00000000..bf13f415 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/hn.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/hr.png b/test/fixtures/stylesheets/compass/images/flag/hr.png new file mode 100644 index 00000000..411479ac Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/hr.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ht.png b/test/fixtures/stylesheets/compass/images/flag/ht.png new file mode 100644 index 00000000..9dbf4c33 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ht.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/hu.png b/test/fixtures/stylesheets/compass/images/flag/hu.png new file mode 100644 index 00000000..bad18553 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/hu.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/id-2.png b/test/fixtures/stylesheets/compass/images/flag/id-2.png new file mode 100644 index 00000000..3328dd4b Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/id-2.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ie.png b/test/fixtures/stylesheets/compass/images/flag/ie.png new file mode 100644 index 00000000..8772d26e Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ie.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/il.png b/test/fixtures/stylesheets/compass/images/flag/il.png new file mode 100644 index 00000000..d48dd796 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/il.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/in.png b/test/fixtures/stylesheets/compass/images/flag/in.png new file mode 100644 index 00000000..edcad05b Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/in.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/io.png b/test/fixtures/stylesheets/compass/images/flag/io.png new file mode 100644 index 00000000..70f3d1cd Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/io.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/iq.png b/test/fixtures/stylesheets/compass/images/flag/iq.png new file mode 100644 index 00000000..d2ec06ad Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/iq.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ir.png b/test/fixtures/stylesheets/compass/images/flag/ir.png new file mode 100644 index 00000000..b3b81d2d Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ir.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/is.png b/test/fixtures/stylesheets/compass/images/flag/is.png new file mode 100644 index 00000000..c0112f50 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/is.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/it.png b/test/fixtures/stylesheets/compass/images/flag/it.png new file mode 100644 index 00000000..1958bde6 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/it.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/jm.png b/test/fixtures/stylesheets/compass/images/flag/jm.png new file mode 100644 index 00000000..d520d791 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/jm.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/jo.png b/test/fixtures/stylesheets/compass/images/flag/jo.png new file mode 100644 index 00000000..0a267049 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/jo.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/jp.png b/test/fixtures/stylesheets/compass/images/flag/jp.png new file mode 100644 index 00000000..fcf1c582 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/jp.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ke.png b/test/fixtures/stylesheets/compass/images/flag/ke.png new file mode 100644 index 00000000..63254a93 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ke.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/kg.png b/test/fixtures/stylesheets/compass/images/flag/kg.png new file mode 100644 index 00000000..a8ca53d8 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/kg.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/kh.png b/test/fixtures/stylesheets/compass/images/flag/kh.png new file mode 100644 index 00000000..ba7dda0e Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/kh.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ki.png b/test/fixtures/stylesheets/compass/images/flag/ki.png new file mode 100644 index 00000000..fbca54ec Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ki.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/km.png b/test/fixtures/stylesheets/compass/images/flag/km.png new file mode 100644 index 00000000..b3056cb3 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/km.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/kn.png b/test/fixtures/stylesheets/compass/images/flag/kn.png new file mode 100644 index 00000000..9f1d929c Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/kn.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/kp.png b/test/fixtures/stylesheets/compass/images/flag/kp.png new file mode 100644 index 00000000..0ee0167c Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/kp.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/kr.png b/test/fixtures/stylesheets/compass/images/flag/kr.png new file mode 100644 index 00000000..dff624cd Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/kr.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/kw.png b/test/fixtures/stylesheets/compass/images/flag/kw.png new file mode 100644 index 00000000..72bb4f51 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/kw.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ky.png b/test/fixtures/stylesheets/compass/images/flag/ky.png new file mode 100644 index 00000000..fb3c4688 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ky.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/kz.png b/test/fixtures/stylesheets/compass/images/flag/kz.png new file mode 100644 index 00000000..1ed4b915 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/kz.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/la.png b/test/fixtures/stylesheets/compass/images/flag/la.png new file mode 100644 index 00000000..2c11f0bd Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/la.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/lb.png b/test/fixtures/stylesheets/compass/images/flag/lb.png new file mode 100644 index 00000000..3f78e349 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/lb.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/lc.png b/test/fixtures/stylesheets/compass/images/flag/lc.png new file mode 100644 index 00000000..2dbff64f Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/lc.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/li.png b/test/fixtures/stylesheets/compass/images/flag/li.png new file mode 100644 index 00000000..990bd3d8 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/li.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/lk.png b/test/fixtures/stylesheets/compass/images/flag/lk.png new file mode 100644 index 00000000..bb955c3f Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/lk.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/lr.png b/test/fixtures/stylesheets/compass/images/flag/lr.png new file mode 100644 index 00000000..2e07be31 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/lr.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ls.png b/test/fixtures/stylesheets/compass/images/flag/ls.png new file mode 100644 index 00000000..585d4052 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ls.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/lt.png b/test/fixtures/stylesheets/compass/images/flag/lt.png new file mode 100644 index 00000000..2089c091 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/lt.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/lu.png b/test/fixtures/stylesheets/compass/images/flag/lu.png new file mode 100644 index 00000000..c3a14f48 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/lu.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/lv.png b/test/fixtures/stylesheets/compass/images/flag/lv.png new file mode 100644 index 00000000..bd844b2b Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/lv.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ly.png b/test/fixtures/stylesheets/compass/images/flag/ly.png new file mode 100644 index 00000000..654896aa Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ly.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ma.png b/test/fixtures/stylesheets/compass/images/flag/ma.png new file mode 100644 index 00000000..12616153 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ma.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mc.png b/test/fixtures/stylesheets/compass/images/flag/mc.png new file mode 100644 index 00000000..f941984e Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mc.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/md.png b/test/fixtures/stylesheets/compass/images/flag/md.png new file mode 100644 index 00000000..0bf4eb09 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/md.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/me.png b/test/fixtures/stylesheets/compass/images/flag/me.png new file mode 100644 index 00000000..bb8e0708 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/me.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mg.png b/test/fixtures/stylesheets/compass/images/flag/mg.png new file mode 100644 index 00000000..407f9dc8 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mg.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mh.png b/test/fixtures/stylesheets/compass/images/flag/mh.png new file mode 100644 index 00000000..6f4574c2 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mh.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mk.png b/test/fixtures/stylesheets/compass/images/flag/mk.png new file mode 100644 index 00000000..808028fc Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mk.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ml.png b/test/fixtures/stylesheets/compass/images/flag/ml.png new file mode 100644 index 00000000..22382d25 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ml.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mm.png b/test/fixtures/stylesheets/compass/images/flag/mm.png new file mode 100644 index 00000000..2c60244e Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mm.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mn.png b/test/fixtures/stylesheets/compass/images/flag/mn.png new file mode 100644 index 00000000..36349d93 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mn.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mo.png b/test/fixtures/stylesheets/compass/images/flag/mo.png new file mode 100644 index 00000000..bd458be2 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mo.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mp.png b/test/fixtures/stylesheets/compass/images/flag/mp.png new file mode 100644 index 00000000..99116289 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mp.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mq.png b/test/fixtures/stylesheets/compass/images/flag/mq.png new file mode 100644 index 00000000..42d7fb94 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mq.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mr.png b/test/fixtures/stylesheets/compass/images/flag/mr.png new file mode 100644 index 00000000..a09c7d06 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mr.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ms.png b/test/fixtures/stylesheets/compass/images/flag/ms.png new file mode 100644 index 00000000..88cb1c10 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ms.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mt.png b/test/fixtures/stylesheets/compass/images/flag/mt.png new file mode 100644 index 00000000..cbbc712d Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mt.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mu.png b/test/fixtures/stylesheets/compass/images/flag/mu.png new file mode 100644 index 00000000..fe0dec2a Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mu.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mv.png b/test/fixtures/stylesheets/compass/images/flag/mv.png new file mode 100644 index 00000000..5e600ffc Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mv.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mw.png b/test/fixtures/stylesheets/compass/images/flag/mw.png new file mode 100644 index 00000000..4a8d2aca Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mw.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mx.png b/test/fixtures/stylesheets/compass/images/flag/mx.png new file mode 100644 index 00000000..6d88eeb4 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mx.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/my.png b/test/fixtures/stylesheets/compass/images/flag/my.png new file mode 100644 index 00000000..54b6832d Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/my.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/mz.png b/test/fixtures/stylesheets/compass/images/flag/mz.png new file mode 100644 index 00000000..6eb8dcdf Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/mz.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/na.png b/test/fixtures/stylesheets/compass/images/flag/na.png new file mode 100644 index 00000000..77b8abdc Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/na.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/nc.png b/test/fixtures/stylesheets/compass/images/flag/nc.png new file mode 100644 index 00000000..0c64457a Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/nc.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ne.png b/test/fixtures/stylesheets/compass/images/flag/ne.png new file mode 100644 index 00000000..d0220a48 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ne.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/nf.png b/test/fixtures/stylesheets/compass/images/flag/nf.png new file mode 100644 index 00000000..5941921f Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/nf.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ng.png b/test/fixtures/stylesheets/compass/images/flag/ng.png new file mode 100644 index 00000000..00d8a20b Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ng.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ni.png b/test/fixtures/stylesheets/compass/images/flag/ni.png new file mode 100644 index 00000000..c890247e Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ni.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/nl.png b/test/fixtures/stylesheets/compass/images/flag/nl.png new file mode 100644 index 00000000..2379dc30 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/nl.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/no.png b/test/fixtures/stylesheets/compass/images/flag/no.png new file mode 100644 index 00000000..68f0675b Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/no.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/np.png b/test/fixtures/stylesheets/compass/images/flag/np.png new file mode 100644 index 00000000..38d85088 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/np.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/nr.png b/test/fixtures/stylesheets/compass/images/flag/nr.png new file mode 100644 index 00000000..5424a5d5 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/nr.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/nu.png b/test/fixtures/stylesheets/compass/images/flag/nu.png new file mode 100644 index 00000000..4d6ed5b2 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/nu.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/nz.png b/test/fixtures/stylesheets/compass/images/flag/nz.png new file mode 100644 index 00000000..cd82b8de Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/nz.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/om.png b/test/fixtures/stylesheets/compass/images/flag/om.png new file mode 100644 index 00000000..aedacd1d Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/om.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/pa.png b/test/fixtures/stylesheets/compass/images/flag/pa.png new file mode 100644 index 00000000..a7c18406 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/pa.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/pe.png b/test/fixtures/stylesheets/compass/images/flag/pe.png new file mode 100644 index 00000000..ca6677cb Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/pe.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/pf.png b/test/fixtures/stylesheets/compass/images/flag/pf.png new file mode 100644 index 00000000..1e026441 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/pf.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/pg.png b/test/fixtures/stylesheets/compass/images/flag/pg.png new file mode 100644 index 00000000..d86d76f8 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/pg.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ph.png b/test/fixtures/stylesheets/compass/images/flag/ph.png new file mode 100644 index 00000000..b2bdc9ae Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ph.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/pk.png b/test/fixtures/stylesheets/compass/images/flag/pk.png new file mode 100644 index 00000000..eaa20ce1 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/pk.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/pl.png b/test/fixtures/stylesheets/compass/images/flag/pl.png new file mode 100644 index 00000000..d461399f Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/pl.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/pm.png b/test/fixtures/stylesheets/compass/images/flag/pm.png new file mode 100644 index 00000000..55348fd0 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/pm.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/pn.png b/test/fixtures/stylesheets/compass/images/flag/pn.png new file mode 100644 index 00000000..cc8b0dc9 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/pn.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/pr.png b/test/fixtures/stylesheets/compass/images/flag/pr.png new file mode 100644 index 00000000..bd5b2687 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/pr.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ps.png b/test/fixtures/stylesheets/compass/images/flag/ps.png new file mode 100644 index 00000000..10ac07c2 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ps.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/pt.png b/test/fixtures/stylesheets/compass/images/flag/pt.png new file mode 100644 index 00000000..f48a3181 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/pt.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/pw.png b/test/fixtures/stylesheets/compass/images/flag/pw.png new file mode 100644 index 00000000..5a3522a5 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/pw.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/py.png b/test/fixtures/stylesheets/compass/images/flag/py.png new file mode 100644 index 00000000..d2260599 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/py.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/qa.png b/test/fixtures/stylesheets/compass/images/flag/qa.png new file mode 100644 index 00000000..388e6b3e Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/qa.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/re.png b/test/fixtures/stylesheets/compass/images/flag/re.png new file mode 100644 index 00000000..507d28f0 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/re.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ro.png b/test/fixtures/stylesheets/compass/images/flag/ro.png new file mode 100644 index 00000000..4941caff Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ro.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/rs.png b/test/fixtures/stylesheets/compass/images/flag/rs.png new file mode 100644 index 00000000..9108bb58 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/rs.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ru.png b/test/fixtures/stylesheets/compass/images/flag/ru.png new file mode 100644 index 00000000..f10a7933 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ru.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/rw.png b/test/fixtures/stylesheets/compass/images/flag/rw.png new file mode 100644 index 00000000..e2b3e719 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/rw.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sa.png b/test/fixtures/stylesheets/compass/images/flag/sa.png new file mode 100644 index 00000000..60a31818 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sa.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sb.png b/test/fixtures/stylesheets/compass/images/flag/sb.png new file mode 100644 index 00000000..118c5c7d Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sb.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sc.png b/test/fixtures/stylesheets/compass/images/flag/sc.png new file mode 100644 index 00000000..d1080752 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sc.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/scotland.png b/test/fixtures/stylesheets/compass/images/flag/scotland.png new file mode 100644 index 00000000..7d66e7ff Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/scotland.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sd.png b/test/fixtures/stylesheets/compass/images/flag/sd.png new file mode 100644 index 00000000..968716c8 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sd.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/se.png b/test/fixtures/stylesheets/compass/images/flag/se.png new file mode 100644 index 00000000..a3eee573 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/se.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sg.png b/test/fixtures/stylesheets/compass/images/flag/sg.png new file mode 100644 index 00000000..788eb6b7 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sg.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sh.png b/test/fixtures/stylesheets/compass/images/flag/sh.png new file mode 100644 index 00000000..c97eae88 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sh.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/si.png b/test/fixtures/stylesheets/compass/images/flag/si.png new file mode 100644 index 00000000..3e35926b Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/si.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sj.png b/test/fixtures/stylesheets/compass/images/flag/sj.png new file mode 100644 index 00000000..c9e89041 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sj.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sk.png b/test/fixtures/stylesheets/compass/images/flag/sk.png new file mode 100644 index 00000000..ec9ee781 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sk.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sl.png b/test/fixtures/stylesheets/compass/images/flag/sl.png new file mode 100644 index 00000000..c30da74c Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sl.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sm.png b/test/fixtures/stylesheets/compass/images/flag/sm.png new file mode 100644 index 00000000..e2ac0286 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sm.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sn.png b/test/fixtures/stylesheets/compass/images/flag/sn.png new file mode 100644 index 00000000..e48d2fa5 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sn.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/so.png b/test/fixtures/stylesheets/compass/images/flag/so.png new file mode 100644 index 00000000..ef8648ce Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/so.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sr.png b/test/fixtures/stylesheets/compass/images/flag/sr.png new file mode 100644 index 00000000..05170cf4 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sr.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/st.png b/test/fixtures/stylesheets/compass/images/flag/st.png new file mode 100644 index 00000000..76ca2d23 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/st.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sv.png b/test/fixtures/stylesheets/compass/images/flag/sv.png new file mode 100644 index 00000000..96764f36 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sv.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sy.png b/test/fixtures/stylesheets/compass/images/flag/sy.png new file mode 100644 index 00000000..c2069a36 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sy.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/sz.png b/test/fixtures/stylesheets/compass/images/flag/sz.png new file mode 100644 index 00000000..7464eade Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/sz.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/tc.png b/test/fixtures/stylesheets/compass/images/flag/tc.png new file mode 100644 index 00000000..a2743ab5 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/tc.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/td.png b/test/fixtures/stylesheets/compass/images/flag/td.png new file mode 100644 index 00000000..fca8258e Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/td.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/tf.png b/test/fixtures/stylesheets/compass/images/flag/tf.png new file mode 100644 index 00000000..8a87c0da Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/tf.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/tg.png b/test/fixtures/stylesheets/compass/images/flag/tg.png new file mode 100644 index 00000000..76f5aa0d Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/tg.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/th.png b/test/fixtures/stylesheets/compass/images/flag/th.png new file mode 100644 index 00000000..f48a1cd8 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/th.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/tj.png b/test/fixtures/stylesheets/compass/images/flag/tj.png new file mode 100644 index 00000000..67e6a75a Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/tj.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/tk.png b/test/fixtures/stylesheets/compass/images/flag/tk.png new file mode 100644 index 00000000..e778334a Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/tk.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/tl.png b/test/fixtures/stylesheets/compass/images/flag/tl.png new file mode 100644 index 00000000..5492bf96 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/tl.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/tm.png b/test/fixtures/stylesheets/compass/images/flag/tm.png new file mode 100644 index 00000000..85eda048 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/tm.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/tn.png b/test/fixtures/stylesheets/compass/images/flag/tn.png new file mode 100644 index 00000000..fd04bbe2 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/tn.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/to.png b/test/fixtures/stylesheets/compass/images/flag/to.png new file mode 100644 index 00000000..9dd7709b Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/to.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/tr.png b/test/fixtures/stylesheets/compass/images/flag/tr.png new file mode 100644 index 00000000..f64e102f Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/tr.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/tt.png b/test/fixtures/stylesheets/compass/images/flag/tt.png new file mode 100644 index 00000000..73f52178 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/tt.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/tv.png b/test/fixtures/stylesheets/compass/images/flag/tv.png new file mode 100644 index 00000000..c65b6e31 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/tv.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/tw.png b/test/fixtures/stylesheets/compass/images/flag/tw.png new file mode 100644 index 00000000..5808bdf5 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/tw.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/tz.png b/test/fixtures/stylesheets/compass/images/flag/tz.png new file mode 100644 index 00000000..b966c8c4 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/tz.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ua.png b/test/fixtures/stylesheets/compass/images/flag/ua.png new file mode 100644 index 00000000..7a187e6a Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ua.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ug.png b/test/fixtures/stylesheets/compass/images/flag/ug.png new file mode 100644 index 00000000..348b5818 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ug.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/um.png b/test/fixtures/stylesheets/compass/images/flag/um.png new file mode 100644 index 00000000..829fd6e2 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/um.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/us.png b/test/fixtures/stylesheets/compass/images/flag/us.png new file mode 100644 index 00000000..18353b27 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/us.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/uy.png b/test/fixtures/stylesheets/compass/images/flag/uy.png new file mode 100644 index 00000000..8a174a4d Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/uy.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/uz.png b/test/fixtures/stylesheets/compass/images/flag/uz.png new file mode 100644 index 00000000..28ec49bb Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/uz.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/va.png b/test/fixtures/stylesheets/compass/images/flag/va.png new file mode 100644 index 00000000..a8c15e84 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/va.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/vc.png b/test/fixtures/stylesheets/compass/images/flag/vc.png new file mode 100644 index 00000000..212e211d Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/vc.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ve.png b/test/fixtures/stylesheets/compass/images/flag/ve.png new file mode 100644 index 00000000..af53d70b Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ve.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/vg.png b/test/fixtures/stylesheets/compass/images/flag/vg.png new file mode 100644 index 00000000..50593af6 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/vg.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/vi.png b/test/fixtures/stylesheets/compass/images/flag/vi.png new file mode 100644 index 00000000..461f4199 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/vi.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/vn.png b/test/fixtures/stylesheets/compass/images/flag/vn.png new file mode 100644 index 00000000..0b920b39 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/vn.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/vu.png b/test/fixtures/stylesheets/compass/images/flag/vu.png new file mode 100644 index 00000000..f70d27f6 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/vu.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/wales.png b/test/fixtures/stylesheets/compass/images/flag/wales.png new file mode 100644 index 00000000..05838f9f Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/wales.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/wf.png b/test/fixtures/stylesheets/compass/images/flag/wf.png new file mode 100644 index 00000000..6434e110 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/wf.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ws.png b/test/fixtures/stylesheets/compass/images/flag/ws.png new file mode 100644 index 00000000..47c0eb03 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ws.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/ye.png b/test/fixtures/stylesheets/compass/images/flag/ye.png new file mode 100644 index 00000000..54b83d0c Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/ye.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/yt.png b/test/fixtures/stylesheets/compass/images/flag/yt.png new file mode 100644 index 00000000..045a76f9 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/yt.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/za.png b/test/fixtures/stylesheets/compass/images/flag/za.png new file mode 100644 index 00000000..27161f17 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/za.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/zm.png b/test/fixtures/stylesheets/compass/images/flag/zm.png new file mode 100644 index 00000000..c6ab90f5 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/zm.png differ diff --git a/test/fixtures/stylesheets/compass/images/flag/zw.png b/test/fixtures/stylesheets/compass/images/flag/zw.png new file mode 100644 index 00000000..f8941950 Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/flag/zw.png differ diff --git a/test/fixtures/stylesheets/compass/sass/fonts.sass b/test/fixtures/stylesheets/compass/sass/fonts.sass index fdbef5b5..dd191bb1 100644 --- a/test/fixtures/stylesheets/compass/sass/fonts.sass +++ b/test/fixtures/stylesheets/compass/sass/fonts.sass @@ -1,3 +1,3 @@ @import compass/css3/font-face -+font-face("font1", font-files("font1.woff", woff)) \ No newline at end of file ++font-face("font1", font-files("font1.woff", woff), "font1.eot") \ No newline at end of file diff --git a/test/fixtures/stylesheets/compass/sass/gradients.sass b/test/fixtures/stylesheets/compass/sass/gradients.sass index fd0ec96a..dc915aa4 100644 --- a/test/fixtures/stylesheets/compass/sass/gradients.sass +++ b/test/fixtures/stylesheets/compass/sass/gradients.sass @@ -10,20 +10,35 @@ $experimental-support-for-svg: true .bg-shortcut-radial-gradient +background(#fff radial-gradient(center center, #ddd, #aaa 100px)) +.bg-linear-gradient-angle-svg + +background-image(linear-gradient(-45deg, blue, black)) + +.bg-linear-gradient-angle2-svg + +background-image(linear-gradient(top left, blue, black)) + +.bg-all-gradient-types-with-simplification + +background-with-css2-fallback(image-url("4x6.png"), linear-gradient(top left, #ddd, #aaa), radial-gradient(center center, #ddd, #aaa 100px), #ffcc00) + .bg-simple-image +background-image(url('foo.png')) .bg-linear-gradient +background-image(linear-gradient(top left, #ddd, #aaa)) +.bg-linear-gradient-pixel-stop-from-top + +background-image(linear-gradient(top, #ddd 10px, #aaa 40px)) + +.bg-linear-gradient-pixel-stop-from-left + +background-image(linear-gradient(left, #ddd 10px, #aaa 40px)) + .bg-radial-gradient +background-image(radial-gradient(center center, #ddd, #aaa 100px)) .bg-linear-gradient-with-angle - +background-image(linear-gradient(top left -45deg, #ddd, #aaa)) + +background-image(linear-gradient(-45deg, #ddd, #aaa)) .bg-radial-gradient-with-angle-and-shape - +background-image(radial-gradient(center center 45deg, ellipse cover, #ddd, #aaa 100px)) + +background-image(radial-gradient(ellipse cover, #ddd, #aaa 100px)) .bg-all-gradient-types +background-image(image-url("4x6.png"), linear-gradient(top left, #ddd, #aaa), radial-gradient(center center, #ddd, #aaa 100px)) @@ -102,7 +117,7 @@ $experimental-support-for-svg: false .linear-12 +linear-gradient(color-stops(white, blue 33%, black 67%)) - + .radial-1 // A default radial gradient: A centered gradient having the shape of the container (aka ellipse) @@ -215,4 +230,4 @@ $experimental-support-for-svg: true +filter-gradient(white, black, vertical) .ie-alpha-filter - +filter-gradient(rgba(#fff, 1), rgba(#fff, 0)) \ No newline at end of file + +filter-gradient(rgba(#fff, 1), rgba(#fff, 0)) diff --git a/test/fixtures/stylesheets/compass/sass/grid_background.scss b/test/fixtures/stylesheets/compass/sass/grid_background.scss new file mode 100644 index 00000000..4f50ed4a --- /dev/null +++ b/test/fixtures/stylesheets/compass/sass/grid_background.scss @@ -0,0 +1,34 @@ +@import "compass/layout/grid-background"; + +.baseline { + @include baseline-grid-background; +} + +.columns { + @include column-grid-background; +} + +.combined { + @include grid-background; +} + +$grid-background-total-columns: 15; +$grid-background-offset: 11%; +$grid-background-column-width: 5%; +$grid-background-gutter-width: 1%; + +.percent-baseline { + @include baseline-grid-background; +} + +.percent-columns { + @include column-grid-background; +} + +.percent-combined { + @include grid-background; +} + +.forced-fluid { + @include column-grid-background(12, 2em, 1em, 1em, $grid-background-column-color, $grid-background-gutter-color, true); +} \ No newline at end of file diff --git a/test/fixtures/stylesheets/compass/sass/lists.scss b/test/fixtures/stylesheets/compass/sass/lists.scss index 395e879a..3eea1fde 100644 --- a/test/fixtures/stylesheets/compass/sass/lists.scss +++ b/test/fixtures/stylesheets/compass/sass/lists.scss @@ -1,4 +1,4 @@ -@import "compass/utilities/lists"; +@import "compass/typography/lists"; ul.horizontal { @include horizontal-list; } ul.wide-horizontal { @include horizontal-list(10px); } @@ -7,6 +7,6 @@ ul.no-padding { @include horizontal-list(false); } ul.inline-block { @include inline-block-list; } ul.wide-inline-block { @include inline-block-list(10px); } ul.inline { @include inline-list; } -ul.comma { @include comma-delimited-list; } +ul.comma { @include delimited-list; } ul.no-bullets { @include no-bullets; } ul.pretty { @include pretty-bullets("4x6.png"); } \ No newline at end of file diff --git a/test/fixtures/stylesheets/compass/sass/sprites.scss b/test/fixtures/stylesheets/compass/sass/sprites.scss new file mode 100644 index 00000000..9bcbe251 --- /dev/null +++ b/test/fixtures/stylesheets/compass/sass/sprites.scss @@ -0,0 +1,13 @@ +@import "flag/*.png"; + +$flag-sprite-dimensions: true; + +#flags { + @each $flag in us au ca es eg ly { + .#{$flag} { + @include flag-sprite($flag); + } + } +} + +@include all-flag-sprites; diff --git a/test/fixtures/stylesheets/compass/sass/utilities.scss b/test/fixtures/stylesheets/compass/sass/utilities.scss index 1565ed53..7daac2f6 100644 --- a/test/fixtures/stylesheets/compass/sass/utilities.scss +++ b/test/fixtures/stylesheets/compass/sass/utilities.scss @@ -7,3 +7,8 @@ .pie-clearfix { @include pie-clearfix; } + +p.light { @include contrasted(#B0201E); } +p.dark { @include contrasted(#5F1210); } +p.light-with-args { @include contrasted(#B0201E, green, blue); } +p.dark-with-args { @include contrasted(#5F1210, green, blue); } diff --git a/test/fixtures/stylesheets/compass/sass/vertical_rhythm.scss b/test/fixtures/stylesheets/compass/sass/vertical_rhythm.scss new file mode 100644 index 00000000..09b6b224 --- /dev/null +++ b/test/fixtures/stylesheets/compass/sass/vertical_rhythm.scss @@ -0,0 +1,14 @@ +@import "compass/typography/vertical_rhythm"; + +$base-font-size: 14px; +$base-line-height: 16px; + +@include establish-baseline; + +.small { @include adjust-font-size-to(12px,1); } + +.padded { @include rhythm(1,1,1,1); } +.small-padded { @include adjust-font-size-to(12px,1); @include rhythm(1,1,1,1,12px); } + +.borders { @include h-borders(1px,1); } +.large-borders { @include adjust-font-size-to(24px,3); @include h-borders(6px,1,24px); } \ No newline at end of file diff --git a/test/sass_extensions_test.rb b/test/sass_extensions_test.rb index cbd75f8a..569d49f0 100644 --- a/test/sass_extensions_test.rb +++ b/test/sass_extensions_test.rb @@ -89,6 +89,12 @@ class SassExtensionsTest < Test::Unit::TestCase assert_equal "true", evaluate("blank(-compass-space-list(' '))") end + def test_css2_fallback + assert_equal "css3", evaluate("css2-fallback(css3, css2)") + assert_equal "css2", evaluate("-css2(css2-fallback(css3, css2))") + assert_equal "true", evaluate("prefixed(-css2, css2-fallback(css3, css2))") + end + protected def evaluate(value) Sass::Script::Parser.parse(value, 0, 0).perform(Sass::Environment.new).to_s diff --git a/test/test_case_helper.rb b/test/test_case_helper.rb index 3c4f95e0..9110ae5d 100644 --- a/test/test_case_helper.rb +++ b/test/test_case_helper.rb @@ -1,7 +1,7 @@ module Compass module TestCaseHelper def absolutize(path) - if path.blank? + if Compass::Util.blank?(path) File.dirname(__FILE__) elsif path[0] == ?/ "#{File.dirname(__FILE__)}#{path}"