diff --git a/.gitignore b/.gitignore index f04555fd..efbcad5a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.DS_Store *.tmproj +*.lock sync tmp/* examples/*/stylesheets/* diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..c78185e8 --- /dev/null +++ b/Gemfile @@ -0,0 +1,8 @@ +source :rubygems + +gem "compass", :path => "." +gem "cucumber" +gem "rspec" +gem "rails", "~>3.0.0.rc" +gem "compass-validator" +gem "css_parser" diff --git a/Gemfile_rails2 b/Gemfile_rails2 new file mode 100644 index 00000000..2af96342 --- /dev/null +++ b/Gemfile_rails2 @@ -0,0 +1,8 @@ +source :rubygems + +gem "compass", :path => "." +gem "cucumber" +gem "rspec" +gem "rails", "~>2.3" +gem "compass-validator" +gem "css_parser" diff --git a/VERSION.yml b/VERSION.yml index d1d12a74..2712ed5b 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -3,3 +3,4 @@ :minor: 11 :state: alpha :build: 0 + diff --git a/compass.gemspec b/compass.gemspec index 20350f28..a98566a3 100644 --- a/compass.gemspec +++ b/compass.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |gemspec| gemspec.executables = %w(compass) gemspec.has_rdoc = false gemspec.require_paths = %w(lib) - gemspec.rubygems_version = "1.3.6" + gemspec.rubygems_version = "1.3.5" gemspec.summary = %q{A Real Stylesheet Framework} gemspec.add_dependency('haml', '>= 3.0.4') gemspec.files = %w(README.markdown LICENSE.markdown VERSION.yml Rakefile) diff --git a/doc-src/Gemfile.lock b/doc-src/Gemfile.lock index b97f7e76..4e510363 100644 --- a/doc-src/Gemfile.lock +++ b/doc-src/Gemfile.lock @@ -1,116 +1,55 @@ ---- -dependencies: - fssm: - group: - - :default - version: ">= 0" - compass: - group: - - :default - version: ">= 0" - rake: - group: - - :default - version: ">= 0" - haml: - group: - - :default - version: ">= 3.0.6" - require: - - sass - thor: - group: - - :default - version: ">= 0" - serve: - group: - - :default - version: = 0.10.2 - mime-types: - group: - - :default - version: ">= 0" - rack: - group: - - :default - version: ">= 0" - json: - group: - - :default - version: ">= 0" - nanoc3: - group: - - :default - version: ">= 0" - require: [] +GIT + remote: git://github.com/chriseppstein/nanoc.git + revision: 3982942 + branch: 3.1.x + specs: + nanoc3 (3.1.2) + cri (>= 1.0.0) - css-slideshow: - group: - - :default - version: = 0.2.0 - compass-susy-plugin: - group: - - :default - version: ">= 0.7.0.pre8" - rdiscount: - group: - - :default - version: ">= 0" - coderay: - group: - - :default - version: ">= 0" - nokogiri: - group: - - :default - version: ">= 0" -specs: -- rake: - version: 0.8.7 -- activesupport: - version: 2.3.8 -- coderay: - version: 0.9.3 -- haml: - version: 3.0.6 -- compass: - version: 0.10.2 - source: 0 -- compass-susy-plugin: - version: 0.7.0.rc2 -- cri: - version: 1.0.1 -- css-slideshow: - version: 0.2.0 -- fssm: - version: 0.1.4 -- json: - version: 1.4.3 -- mime-types: - version: "1.16" -- nanoc3: - version: 3.1.2 - source: 1 -- nokogiri: - version: 1.4.2 -- rack: - version: 1.1.0 -- rdiscount: - version: 1.6.3.2 -- serve: - version: 0.10.2 -- thor: - version: 0.13.6 -hash: 178d5e4f426c2d1a39af604e5edcd8bae16a395e -sources: -- Path: - path: !ruby/object:Pathname - path: .. -- Git: - uri: git://github.com/chriseppstein/nanoc.git - branch: 3.1.x - require: false - git: git://github.com/chriseppstein/nanoc.git - ref: 398294262623dac9bb15dcbbfc0ba33c04f8125e -- Rubygems: - uri: http://gemcutter.org +PATH + remote: /Users/chris/Projects/compass + specs: + compass (0.10.5.pre.0) + haml (>= 3.0.4) + +GEM + remote: http://rubygems.org/ + specs: + activesupport (2.3.8) + coderay (0.9.3) + compass-susy-plugin (0.7.0) + compass (>= 0.10.0) + cri (1.0.1) + css-slideshow (0.2.0) + compass (>= 0.10.0.rc3) + fssm (0.1.4) + haml (3.0.16) + json (1.4.5) + mime-types (1.16) + nokogiri (1.4.3.1) + rack (1.2.1) + rake (0.8.7) + rdiscount (1.6.5) + serve (0.10.2) + activesupport (>= 2.0.2) + thor (0.14.0) + +PLATFORMS + ruby + +DEPENDENCIES + coderay + compass! + compass-susy-plugin (>= 0.7.0.pre8) + css-slideshow (= 0.2.0) + fssm + haml (>= 3.0.6) + json + mime-types + nanoc3! + nokogiri + rack + rake + rdiscount + serve (= 0.10.2) + thor diff --git a/doc-src/Rules b/doc-src/Rules index 25875512..0e3d13c4 100644 --- a/doc-src/Rules +++ b/doc-src/Rules @@ -2,8 +2,6 @@ require 'compass' -puts "Compass running from: #{Compass.lib_directory}" - Compass.add_configuration "#{File.dirname(__FILE__)}/.compass/config.rb" SITE_ROOT = "/docs" diff --git a/doc-src/content/CHANGELOG.markdown b/doc-src/content/CHANGELOG.markdown index cf107d4e..b887912d 100644 --- a/doc-src/content/CHANGELOG.markdown +++ b/doc-src/content/CHANGELOG.markdown @@ -7,6 +7,7 @@ layout: article COMPASS CHANGELOG ================= +<<<<<<< HEAD:doc-src/content/CHANGELOG.markdown 0.11.alpha.1 ------------ @@ -39,6 +40,79 @@ COMPASS CHANGELOG * `+opacity` no longer uses any prefixed variations, as IE uses `filter` and all other modern browsers support the official spec or nothing at all. +======= +0.10.5 (UNRELEASED) +------------------- + +* The [HTML5 Reset mixin][html5-reset] now resets the following new elements: + `canvas`, `details`, `figcaption`, `hgroup`, `menu`, `summary` +* A new Utility mixin has been added: [inline-block-list][inline-block-list]. +* Compass projects can now (as was always intended) use paths outside of the project directory + for css, images, fonts, etc by configuring those locations using `xxx_path` instead of + `xxx_dir`. For instance: `css_path = "/var/www/docroot/css"`. It is recommended + to set the corresponding `http_xxx_path` when you do this, for instance: + `http_stylesheets_path = "/css"`. On the command line, all absolute urls are + treated as paths instead of relative directories so + `--css-dir /var/www/docroot/css` will set `css_path`. Should both a directory + and a path be specified, the path will override the corresponding directory. + +0.10.4 (8/08/2010) +------------------ + +* [Rails] Fixed a bug introduced in 0.10.3 that caused rails applications using the old configuration file (config/compass.config) to break. +* [Extensions] Make it easier to create manifest files by allowing template files to be discovered. See the Manifest Declarations section of [extensions tutorial](http://compass-style.org/docs/tutorials/extensions/) for details. +* [Rails] Don't install configuration files when installing extensions. +* [Compass Core] All url helpers now accept a second argument that when true will cause only the path to be emitted. This allows the url helpers to be used with IE filters. + +0.10.3 (8/1/2010) +----------------- + +### !important + +All rails users should run the following command: + + compass init rails --prepare + +This will update your compass initializer file. + +### Compass Core + +* Add missing clearfix import to horizontal-list. +* Emit less css for inline lists with the same result. +* New helper `opposite-position($position)` returns the opposite value of a position. [Documentation](http://compass-style.org/docs/reference/compass/helpers/constants/) +* Allow horizontal lists to be floated to the right. +* Bugfix for inline-font-files helper. +* `+font-face` mixin no longer uses `$postscript` name or `$style` type variables, in favor of the Paul Irish [smiley bulletproof technique](http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/). Older declarations will still work, but will not apply the variables and will display a deprecation warning. +* `+box-shadow` now supports `$spread` length and `$inset` declarations. +* The gradient mixins output official w3c declarations along with the `-webkit` and `-moz` prefixed versions. The official code is based on the w3c spec and is nearly ideantical to the mozilla version, although it is currently not supported by any browser. +* `+opacity` no longer uses any prefixed variations, as IE uses `filter` and + all other modern browsers support the official spec or nothing at all. +* Support for specifying horizontal and vertical radii for the shorthand border-radius property. +* The `has-layout` mixin now uses pixels instead of ems to work around an opera bug. + +### Blueprint +* Two colors used in typography can now be customized. +* Support for inputs of type email. + +### Extensions +* Extensions can now create empty directories with the `directory` directive. [Docs](http://compass-style.org/docs/tutorials/extensions/). +* It's now easier to load extensions from a configuration file using the `load` and `discover` directives. + +### Rails + +As stated above, all rails users should run the following command: + + compass init rails . --prepare + +This will fix a bug in the rails initializer that caused compass extensions to not be recognized when placed into the `vendor/plugins/compass_extensions` directory. It will also make sure that future bugs in the boot process won't require an end-user action to fix. + + +### Contributors: + +* [Milo Winningham](http://github.com/quadule) +* [jonathanpberger](http://github.com/jonathanpberger) +* [Stephan Kaag](http://github.com/stephankaag) +>>>>>>> stable:doc-src/content/CHANGELOG.markdown 0.10.2 (May 31, 2010) --------------------- @@ -792,3 +866,5 @@ 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/docs/reference/compass/utilities/lists/inline-block-list/ +[html5-reset]: http://compass-style.org/docs/reference/compass/reset/utilities/#mixin-reset-html5 \ No newline at end of file diff --git a/doc-src/content/index/mixins.haml b/doc-src/content/index/mixins.haml new file mode 100644 index 00000000..3980026e --- /dev/null +++ b/doc-src/content/index/mixins.haml @@ -0,0 +1,14 @@ +--- +title: Compass Documentation | All Mixins +crumb: Docs +body_id: home +--- +%article + %h1#logo Compass Mixins + + - all_mixins.sort_by{|i| i.first.identifier}.each do |item, mixins| + %h3= link_to item[:title], item + %ul + - mixins.sort_by{|m| m.name}.each do |m| + %li= mixin_signature(m) + diff --git a/doc-src/content/index/variables.haml b/doc-src/content/index/variables.haml new file mode 100644 index 00000000..dcb78594 --- /dev/null +++ b/doc-src/content/index/variables.haml @@ -0,0 +1,15 @@ +--- +title: Compass Documentation | All Variables +crumb: Docs +body_id: home +--- +%article + %h1#logo Compass Variables + + - all_constants.sort_by{|i| i.first.identifier}.each do |item, constants| + %h3= link_to item[:title], item + %ul + - constants.sort_by{|c| c.name}.each do |c| + %li $#{c.name} + + \ No newline at end of file diff --git a/doc-src/content/reference/compass/helpers/constants.haml b/doc-src/content/reference/compass/helpers/constants.haml new file mode 100644 index 00000000..b619dfe4 --- /dev/null +++ b/doc-src/content/reference/compass/helpers/constants.haml @@ -0,0 +1,31 @@ +--- +title: Compass Constant Helpers +crumb: Constants +framework: compass +meta_description: Helper functions for working with constants. +layout: core +classnames: + - reference + - core + - helpers +--- +%h1 Compass Constant Helpers + +:markdown + These helpers manipulate CSS Constants. + +#opposite-position.helper + %h3 + %a(href="#opposite-position") + opposite-position($position) + .details + :markdown + Returns the opposition position for the position given. Examples: + + Input Output + ------------------------------- ------------ + opposite-position(left) => right + opposite-position(top) => bottom + opposite-position(center) => center + opposite-position(top left) => bottom right + opposite-position(center right) => center left diff --git a/doc-src/content/reference/compass/helpers/urls.haml b/doc-src/content/reference/compass/helpers/urls.haml index 69fb818e..d0ffed70 100644 --- a/doc-src/content/reference/compass/helpers/urls.haml +++ b/doc-src/content/reference/compass/helpers/urls.haml @@ -21,24 +21,33 @@ classnames: #stylesheet-url.helper %h3 %a(href="#stylesheet-url") - stylesheet-url($path) + stylesheet-url($path, $only-path: false) .details %p Generates a path to an asset found relative to the project's css directory. + %br + Passing a true value as the second argument will cause the only the path to be returned + instead of a `url()` function #font-url.helper %h3 %a(href="#font-url") - font-url($path) + font-url($path, $only-path: false) .details %p Generates a path to an asset found relative to the project's font directory. + %br + Passing a true value as the second argument will cause the only the path to be returned + instead of a `url()` function #image-url.helper %h3 %a(href="#image-url") - image-url($path) + image-url($path, $only-path: false) .details %p Generates a path to an asset found relative to the project's images directory. + %br + Passing a true value as the second argument will cause the only the path to be returned + instead of a `url()` function diff --git a/doc-src/content/reference/compass/utilities/lists/inline-block-list.haml b/doc-src/content/reference/compass/utilities/lists/inline-block-list.haml new file mode 100644 index 00000000..c315e30b --- /dev/null +++ b/doc-src/content/reference/compass/utilities/lists/inline-block-list.haml @@ -0,0 +1,30 @@ +--- +title: Compass Inline-Block List +crumb: Inline-Block List +framework: compass +stylesheet: compass/utilities/lists/_inline-block-list.scss +layout: core +meta_description: set list-elements to inline-block so they appear horizontally while retaining their structure. +nav_stylesheet: compass/_utilities.scss +classnames: + - reference + - core + - utilities +--- +- render 'reference' do + :markdown + 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 diff --git a/doc-src/content/tutorials/best_practices.markdown b/doc-src/content/tutorials/best_practices.markdown index b05708ce..3b3cbb0e 100644 --- a/doc-src/content/tutorials/best_practices.markdown +++ b/doc-src/content/tutorials/best_practices.markdown @@ -17,7 +17,7 @@ variables and ([often][2]) the framework utilities you plan to use: @import "compass/reset"; @import "compass/utilities"; - @import "blueprint/screen"; + @import "blueprint"; // etc. diff --git a/doc-src/content/tutorials/configuration-reference.markdown b/doc-src/content/tutorials/configuration-reference.markdown index d3a2d1f2..d62b89b7 100644 --- a/doc-src/content/tutorials/configuration-reference.markdown +++ b/doc-src/content/tutorials/configuration-reference.markdown @@ -108,6 +108,18 @@ command line will override the corresponding settings in your configuration file Defaults to "stylesheets". + + css_path + String + The full path to where css stylesheets are kept. + Defaults to <project_path>/<css_dir>. + + + + http_stylesheets_path + String + The full http path to stylesheets on the web server. Defaults to http_path + "/" + css_dir. + sass_dir String @@ -115,6 +127,13 @@ command line will override the corresponding settings in your configuration file It is relative to the project_path. Defaults to "src". + + sass_path + String + The full path to where sass stylesheets are kept. + Defaults to <project_path>/<sass_dir>. + + images_dir String @@ -123,6 +142,20 @@ command line will override the corresponding settings in your configuration file Defaults to "images". + + images_path + String + The full path to where images are kept. + Defaults to <project_path>/<images_dir>. + + + + http_images_path + String + The full http path to images on the web server. + Defaults to http_path + "/" + images_dir. + + javascripts_dir String @@ -131,6 +164,20 @@ command line will override the corresponding settings in your configuration file "javascripts". + + javascripts_path + String + The full path to where javascripts are kept. + Defaults to <project_path>/<javascripts_dir>. + + + + http_javascripts_path + String + The full http path to javascripts on the web server. + Defaults to http_path + "/" + javascripts_dir. + + output_style Symbol @@ -147,25 +194,6 @@ command line will override the corresponding settings in your configuration file using the http path for that asset type. - - http_images_path - String - The full http path to images on the web server. - Defaults to http_path + "/" + images_dir. - - - - http_stylesheets_path - String - The full http path to stylesheets on the web server. Defaults to http_path + "/" + css_dir. - - - http_javascripts_path - String - The full http path to javascripts on the web server. - Defaults to http_path + "/" + javascripts_dir. - - additional_import_paths Array of Strings diff --git a/doc-src/content/tutorials/extensions.markdown b/doc-src/content/tutorials/extensions.markdown index 969142a0..a928abfe 100644 --- a/doc-src/content/tutorials/extensions.markdown +++ b/doc-src/content/tutorials/extensions.markdown @@ -165,13 +165,26 @@ You may also see some real manifest files here: ### Manifest Declarations -There are five kinds of manifest declarations: +**Easy Mode:** If you just have some basic files and nothing fancy going on, simply place this line in your manifest: + + discover :all + +This will cause compass to find all the files in your template and use the files' extension to determine where they should go. Alternatively, you can request that compass only discover files of a certain type. For example, the following will only discover javascript and image assets, you could then declare other file types on your own. + + discover :javascripts + discover :images + +The following types may be discovered: `:stylesheets`, `:images`, `:javascripts`, `:fonts`, `:html`, `:files`, and `:directories` + +**Normal Mode:** There are seven kinds of manifest declarations: 1. `stylesheet` - Declares a sass file. 2. `image` - Declares an image. 3. `javascript` - Declares a javascript file. -4. `html` - Declares an html file. -5. `file` - Declares a random file. +4. `font` - Declares a font file. +5. `html` - Declares an html file. +6. `file` - Declares a random file. +7. `directory` - Declares a directory should be created. All declarations take the path to the file as their first argument. Note that the normal slash `/` can and should be used in a manifest. Compass will take care of @@ -196,6 +209,15 @@ Stylesheet options: * `:condition` - this is used to hint the user that a conditional comment should be used to import the stylesheet with the given condition. +Directory options: + +* `:within` - where the directory should be created. If omitted, the directory + will be relative to the project directory. Can be one of: the following + * `sass_dir` + * `javascripts_dir` + * `fonts_dir` + * `images_dir` + HTML files: You can provide html as haml or as plain html. If you provide haml, the haml will be diff --git a/doc-src/layouts/blueprint.haml b/doc-src/layouts/blueprint.haml index b17f15a1..e1797ced 100644 --- a/doc-src/layouts/blueprint.haml +++ b/doc-src/layouts/blueprint.haml @@ -1,5 +1,5 @@ - render 'main' do %aside(role="sidebar") %nav#local-nav - %ul=item_tree(reference_item(:stylesheet => "_blueprint.scss"), :depth => 2, :omit_self => false, :heading_level => 2) + %ul=item_tree(reference_item(:stylesheet => "blueprint.scss"), :depth => 2, :omit_self => false, :heading_level => 2) %article= yield \ No newline at end of file diff --git a/doc-src/layouts/core.haml b/doc-src/layouts/core.haml index 15b59b99..b146930d 100644 --- a/doc-src/layouts/core.haml +++ b/doc-src/layouts/core.haml @@ -1,5 +1,5 @@ - render 'main' do - content_for :module_nav do - %ul= item_tree(reference_item(:stylesheet => "_compass.scss"), :depth => 1, :omit_self => true, :headings => false) + %ul= item_tree(reference_item(:stylesheet => "compass.scss"), :depth => 1, :omit_self => true, :headings => false) %aside(role="sidebar")= render 'partials/sidebar', :default_stylesheet => "_compass.scss" %article= yield \ No newline at end of file diff --git a/doc-src/layouts/reference.haml b/doc-src/layouts/reference.haml index e375a893..f577c504 100644 --- a/doc-src/layouts/reference.haml +++ b/doc-src/layouts/reference.haml @@ -7,7 +7,7 @@ %code @import "#{departialize(item[:stylesheet][0..-6])}" %p - - gh_url = "http://github.com/chriseppstein/compass/blob/master/frameworks/" + - gh_url = "http://github.com/chriseppstein/compass/blob/stable/frameworks/" - gh_url << "#{item[:framework]}/stylesheets/#{item[:stylesheet]}" View the %a{:href => gh_url} Source for this module on Github. diff --git a/doc-src/lib/data_sources/syntax_highter.rb b/doc-src/lib/data_sources/syntax_highter.rb index 36eb8ff7..a2faacba 100644 --- a/doc-src/lib/data_sources/syntax_highter.rb +++ b/doc-src/lib/data_sources/syntax_highter.rb @@ -11,7 +11,7 @@ class SyntaxHighlighterFilter < Nanoc3::Filter def pygmentize(code, type) # -O linenos=table - IO.popen("pygmentize -l #{type} -f html", "r+") do |io| + IO.popen("pygmentize -l #{type} -f html -O encoding=utf-8", "r+") do |io| io.write(code) io.close_write return io.read diff --git a/doc-src/lib/stylesheets.rb b/doc-src/lib/stylesheets.rb index 28c8186f..69348aa6 100644 --- a/doc-src/lib/stylesheets.rb +++ b/doc-src/lib/stylesheets.rb @@ -30,9 +30,9 @@ end def reference_item(options) stylesheet = options[:stylesheet] - @site.cached("reference/item/#{stylesheet}") do - path = stylesheet_path(stylesheet) - if path + path = stylesheet_path(stylesheet) + if path + @site.cached("reference/item/#{path}") do @items.detect do |i| if i.identifier =~ /^\/reference/ && i[:stylesheet] i[:stylesheet] == path @@ -54,27 +54,28 @@ def reference_path(options) end def import_paths - paths = Compass::Frameworks::ALL.inject([]) {|m, f| m << f.stylesheets_directory} - paths.map!{|p|[p, '']} + paths = [] if @item[:stylesheet] paths << [File.join(Compass::Frameworks[@item[:framework]].stylesheets_directory, - File.dirname(@item[:stylesheet])), File.dirname(@item[:stylesheet])] + File.dirname(@item[:stylesheet])), + @item[:stylesheet]["/"] ? File.dirname(@item[:stylesheet]) : ""] end + + paths += Compass::Frameworks::ALL.inject([]) {|m, f| m << f.stylesheets_directory}.map!{|p|[p, '']} paths end def stylesheet_path(ss) - @site.cached("stylesheet/path/#{ss}") do - possible_names = possible_filenames_for_stylesheet(ss) - import_paths.each do |import_path| - possible_names.each do |filename| - full_path = File.join(import_path.first, filename) - if File.exist?(full_path) - return "#{import_path.last}#{"/" if import_path.last && import_path.last.length > 0}#{filename}" - end + possible_names = possible_filenames_for_stylesheet(ss) + import_paths.each do |import_path| + possible_names.each do |filename| + full_path = File.join(import_path.first, filename) + if File.exist?(full_path) + return "#{import_path.last}#{"/" if import_path.last && import_path.last.length > 0}#{filename}" end end end + nil end def possible_filenames_for_stylesheet(ss) @@ -85,9 +86,9 @@ def possible_filenames_for_stylesheet(ss) extensions = if ext.size > 0 [ext] else - [".sass", ".scss"] + [".scss", ".sass"] end - basenames = [base, "_#{base}"] + basenames = ["_#{base}", base] filenames = [] basenames.each do |basename| extensions.each do |extension| @@ -125,6 +126,7 @@ def constants(item) if child.is_a?(Sass::Tree::VariableNode) child.comment = comment && Sass::Tree::CommentNode.clean(comment) comment = nil + child.name.tr!("_",'-') constants << child elsif child.is_a?(Sass::Tree::CommentNode) comment ||= "" @@ -137,6 +139,32 @@ def constants(item) constants end +def all_constants + variables = [] + @items.each do |item| + next unless item.identifier =~ %r{/reference} + next unless item[:stylesheet] + vars = constants(item) + if vars.any? + variables << [item, vars] + end + end + variables +end + +def all_mixins + all_mixins = [] + @items.each do |item| + next unless item.identifier =~ %r{/reference} + next unless item[:stylesheet] + ms = mixins(item) + if ms.any? + all_mixins << [item, ms] + end + end + all_mixins +end + def mixin_signature(mixin, format = :html) mixin.sass_signature(:none, format) end diff --git a/examples/compass/src/bp_layout.scss b/examples/compass/src/bp_layout.scss new file mode 100644 index 00000000..0f8775a4 --- /dev/null +++ b/examples/compass/src/bp_layout.scss @@ -0,0 +1,18 @@ +@import "compass/layout/floated"; + +// It's easy to build a grid with a floated layout +$gutter: $compass-gutter-width; +$col-width: 30px; +$number-of-columns: 24; +$total-width: $number-of-columns * ($col-width + $gutter) - $gutter ; + +@mixin span($n) { + width: $n * ($col-width + $gutter) - $gutter; +} + +// Provides a number of base classes. +@include act-like-blueprint; + +#page { @extend .container; @include span($number-of-columns); } +#sidebar { @extend .column; @include span(8); } +#content { @extend .column; @include span(16); @extend .last; } diff --git a/features/command_line.feature b/features/command_line.feature index 95a957ed..5ce32ad7 100644 --- a/features/command_line.feature +++ b/features/command_line.feature @@ -258,16 +258,22 @@ Feature: Command Line Given I am using the existing project in test/fixtures/stylesheets/compass When I run: compass stats Then I am told statistics for each file: - | Filename | Rules | Properties | Mixins Defs | Mixins Used | CSS Rules | CSS Properties | - | sass/box.sass | 15 | 0 | 0 | 19 | 15 | 59 | - | sass/gradients.sass | 19 | 0 | 0 | 19 | 19 | 19 | - | sass/image_size.sass | 4 | 8 | 0 | 0 | 4 | 8 | - | sass/layout.sass | 0 | 0 | 0 | 1 | 5 | 10 | - | sass/print.sass | 0 | 0 | 0 | 2 | 61 | 61 | - | sass/reset.sass | 4 | 1 | 0 | 2 | 190 | 664 | - | sass/utilities.scss | 2 | 0 | 0 | 2 | 5 | 11 | - | Total.* | 44 | 9 | 0 | 45 | 299 | 832 | - + | Filename | Rules | Properties | Mixins Defs | Mixins Used | CSS Rules | CSS Properties | + | sass/border_radius.scss | 3 | 0 | 0 | 3 | 3 | 18 | + | sass/box.sass | 15 | 0 | 0 | 19 | 15 | 59 | + | sass/fonts.sass | 0 | 0 | 0 | 1 | 1 | 2 | + | sass/gradients.sass | 19 | 0 | 0 | 19 | 19 | 19 | + | sass/image_size.sass | 4 | 8 | 0 | 0 | 4 | 8 | + | sass/images.scss | 3 | 3 | 0 | 0 | 3 | 3 | + | sass/layout.sass | 0 | 0 | 0 | 1 | 5 | 10 | + | sass/legacy_clearfix.scss | 2 | 0 | 0 | 2 | 5 | 11 | + | sass/lists.scss | 9 | 0 | 0 | 9 | 35 | 111 | + | sass/print.sass | 0 | 0 | 0 | 2 | 61 | 61 | + | sass/reset.sass | 4 | 1 | 0 | 2 | 190 | 664 | + | sass/utilities.scss | 2 | 0 | 0 | 2 | 3 | 9 | + | ------------------------- | ----- | ---------- | -------------- | ----------- | --------- | -------------- | + | Total.* | 61 | 12 | 0 | 60 | 344 | 975 | + @listframeworks Scenario: List frameworks registered with compass When I run: compass frameworks diff --git a/features/step_definitions/command_line_steps.rb b/features/step_definitions/command_line_steps.rb index 284fb48b..e9209f1f 100644 --- a/features/step_definitions/command_line_steps.rb +++ b/features/step_definitions/command_line_steps.rb @@ -34,7 +34,7 @@ Given %r{^I am in the parent directory$} do Dir.chdir ".." end -Given /^I'm in a newly created rails project: (.+)$/ do |project_name| +Given %r{^I'm in a newly created rails project: (.+)$} do |project_name| @cleanup_directories << project_name begin generate_rails_app project_name diff --git a/frameworks/blueprint/stylesheets/blueprint/_buttons.scss b/frameworks/blueprint/stylesheets/blueprint/_buttons.scss index 202dba0c..14af8224 100644 --- a/frameworks/blueprint/stylesheets/blueprint/_buttons.scss +++ b/frameworks/blueprint/stylesheets/blueprint/_buttons.scss @@ -23,8 +23,7 @@ $blueprint_button_active_font_color: white !default; // Sets the colors for a button // @param border_highlight_color // The highlight color defaults to whatever is the value of the border_color but it's one shade lighter. -@mixin button-colors -( +@mixin button-colors( $font_color: $blueprint_button_font_color, $bg_color: $blueprint_button_background_color, $border_color: $blueprint_button_border_color, @@ -39,8 +38,7 @@ $blueprint_button_active_font_color: white !default; // Sets the colors for a button in the active state // @param border_highlight_color // The highlight color defaults to whatever is the value of the border_color but it's one shade lighter. -@mixin button-active-colors -( +@mixin button-active-colors( $font_color: $blueprint_button_active_font_color, $bg_color: $blueprint_button_active_background_color, $border_color: $blueprint_button_active_border_color, @@ -55,8 +53,7 @@ $blueprint_button_active_font_color: white !default; // Sets the colors for a button in the hover state. // @param border_highlight_color // The highlight color defaults to whatever is the value of the border_color but it's one shade lighter. -@mixin button-hover-colors -( +@mixin button-hover-colors( $font_color: $blueprint_button_hover_font_color, $bg_color: $blueprint_button_hover_background_color, $border_color: $blueprint_button_hover_border_color, @@ -101,4 +98,4 @@ $blueprint_button_active_font_color: white !default; *:first-child+html &[type] { padding: 4px 10px 3px 7px; } -} +} \ No newline at end of file diff --git a/frameworks/blueprint/stylesheets/blueprint/_colors.scss b/frameworks/blueprint/stylesheets/blueprint/_colors.scss index cafb3d32..91f60a65 100644 --- a/frameworks/blueprint/stylesheets/blueprint/_colors.scss +++ b/frameworks/blueprint/stylesheets/blueprint/_colors.scss @@ -3,6 +3,7 @@ $quiet-color: lighten($font-color, 20%) !default; $loud-color: darken($font-color, 13.33%) !default; $header-color: darken($font-color, 6.67%) !default; $alt-text-color: #666666 !default; +$blueprint-background-color: #eeeeee !default; $link-color: #000099 !default; $link-hover-color: black !default; diff --git a/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss b/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss index 27fa0ed1..b6bf33c8 100644 --- a/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss +++ b/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss @@ -56,8 +56,7 @@ $alternate-text-font : "Warnock Pro", "Goudy Old Style", "Palatino", "Book Antiq // `$base-font-size` - The base font size in pixels. Defaults to 12px // `$old-line-height` - The old line height. Defaults to 1.5 times the base-font-size -@mixin incr -( +@mixin incr( $font-size: 10px, $base-font-size: $blueprint-font-size, $old-line-height: $base-font-size * 1.5 diff --git a/frameworks/blueprint/stylesheets/blueprint/_form.scss b/frameworks/blueprint/stylesheets/blueprint/_form.scss index f4256446..fe4afe38 100644 --- a/frameworks/blueprint/stylesheets/blueprint/_form.scss +++ b/frameworks/blueprint/stylesheets/blueprint/_form.scss @@ -21,6 +21,7 @@ input { &.text, &.title, + &[type=email], &[type=text], &[type=password] { margin: 0.5em 0; background-color: white; padding: 5px; } &.title { font-size: 1.5em; } @@ -42,6 +43,7 @@ input { &.text, &.title, + &[type=email], &[type=text], &[type=password] { width: $input_width; } } @@ -56,7 +58,7 @@ ) { fieldset { border: 1px solid $fieldset_border_color; } - input.text, input.title, input[type=text], input[type=password], + input.text, input.title, input[type=email], input[type=text], input[type=password], textarea, select { border: 1px solid $unfocused_border_color; &:focus { diff --git a/frameworks/blueprint/stylesheets/blueprint/_typography.scss b/frameworks/blueprint/stylesheets/blueprint/_typography.scss index 65ac4916..6697aecc 100644 --- a/frameworks/blueprint/stylesheets/blueprint/_typography.scss +++ b/frameworks/blueprint/stylesheets/blueprint/_typography.scss @@ -61,14 +61,14 @@ $blueprint-font-size: 12px !default; img.right { @include float-right; margin: 1.5em 0 1.5em 1.5em; padding: 0; } } a { text-decoration: underline; @include link-colors($link-color, $link-hover-color, $link-active-color, $link-visited-color, $link-focus-color); } - blockquote { margin: 1.5em; color: #666666; font-style: italic; } + blockquote { margin: 1.5em; color: $alt_text_color; font-style: italic; } strong { font-weight: bold; } em { font-style: italic; } dfn { font-style: italic; font-weight: bold; } sup, sub { line-height: 0; } abbr, acronym { border-bottom: 1px dotted #666666; } address { margin: 0 0 1.5em; font-style: italic; } - del { color: #666666; } + del { color: $alt_text_color; } pre { margin: 1.5em 0; white-space: pre; } pre, code, tt { @include fixed-width-text; } li ul, li ol { margin: 0; } @@ -84,7 +84,7 @@ $blueprint-font-size: 12px !default; th, td, caption { padding: 4px 10px 4px 5px; } tr.even td { background: $blueprint-table-stripe-color; } tfoot { font-style: italic; } - caption { background: #eeeeee; } + caption { background: $blueprint_background_color; } .quiet { @include quiet; } .loud { @include loud; } } diff --git a/frameworks/compass/stylesheets/compass/css3/_border-radius.scss b/frameworks/compass/stylesheets/compass/css3/_border-radius.scss index f3232318..4870b1e9 100644 --- a/frameworks/compass/stylesheets/compass/css3/_border-radius.scss +++ b/frameworks/compass/stylesheets/compass/css3/_border-radius.scss @@ -3,9 +3,69 @@ $default-border-radius: 5px !default; // Round all corners by a specific amount, defaults to value of `$default-border-radius`. +// +// When two values are passed, the first is the horizontal radius +// and the second is the vertical radius. +// +// Note: webkit does not support shorthand syntax for several corners at once. +// So in the case where you pass several values only the first will be passed to webkit. +// +// Examples: +// +// .simple { @include border-radius(4px, 4px); } +// .compound { @include border-radius(2px 5px, 3px 6px); } +// .crazy { @include border-radius(1px 3px 5px 7px, 2px 4px 6px 8px)} +// +// Which generates: +// .simple { +// -webkit-border-radius: 4px 4px; +// -moz-border-radius: 4px / 4px; +// -o-border-radius: 4px / 4px; +// -ms-border-radius: 4px / 4px; +// -khtml-border-radius: 4px / 4px; +// border-radius: 4px / 4px; } +// +// .compound { +// -webkit-border-radius: 2px 3px; +// -moz-border-radius: 2px 5px / 3px 6px; +// -o-border-radius: 2px 5px / 3px 6px; +// -ms-border-radius: 2px 5px / 3px 6px; +// -khtml-border-radius: 2px 5px / 3px 6px; +// border-radius: 2px 5px / 3px 6px; } +// +// .crazy { +// -webkit-border-radius: 1px 2px; +// -moz-border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px; +// -o-border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px; +// -ms-border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px; +// -khtml-border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px; +// border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px; } -@mixin border-radius($radius: $default-border-radius) { - @include experimental(border-radius, $radius); +@mixin border-radius($radius: $default-border-radius, $vertical-radius: false) { + + @if $vertical-radius { + // Webkit doesn't understand the official shorthand syntax for specifying + // a vertical radius unless so in case there's several we only take the first. + @include experimental(border-radius, first-value-of($radius) first-value-of($vertical-radius), + not -moz, + -webkit, + not -o, + not -ms, + not -khtml, + not official + ); + @include experimental("border-radius", $radius unquote("/") $vertical-radius, + -moz, + not -webkit, + -o, + -ms, + -khtml, + official + ); + } + @else { + @include experimental(border-radius, $radius); + } } // Round radius at position by amount. diff --git a/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss b/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss index eb70c898..76b78b91 100644 --- a/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss +++ b/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss @@ -18,10 +18,10 @@ $default-box-shadow-v-offset: 1px !default; $default-box-shadow-blur: 5px !default; // The default spread length. -$default-box-shadow-spread : 0 !default +$default-box-shadow-spread : 0 !default; // The default shadow instet: inset or false (for standard shadow). -$default-box-shadow-inset : false !default +$default-box-shadow-inset : false !default; // Provides cross-browser CSS box shadows for Webkit, Gecko, and CSS3. // Arguments are color, horizontal offset, vertical offset, blur length, spread length, and inset. diff --git a/frameworks/compass/stylesheets/compass/css3/_font-face.scss b/frameworks/compass/stylesheets/compass/css3/_font-face.scss index 9a8253f7..2c023b91 100644 --- a/frameworks/compass/stylesheets/compass/css3/_font-face.scss +++ b/frameworks/compass/stylesheets/compass/css3/_font-face.scss @@ -12,11 +12,10 @@ @warn "The $postscript and $style variables have been deprecated in favor of the Paul Irish smiley bulletproof technique."; } @font-face { - font-family: "#{$name}"; - @if $eot { - src: font-url($eot); } - src: local("☺"), #{$font-files}; - } + font-family: quote($name); + @if $eot { src: font-url($eot); } + src: local("☺"), $font-files; + } } // EXAMPLE diff --git a/frameworks/compass/stylesheets/compass/css3/_gradient.scss b/frameworks/compass/stylesheets/compass/css3/_gradient.scss index 8e68b6c4..dd5e36be 100644 --- a/frameworks/compass/stylesheets/compass/css3/_gradient.scss +++ b/frameworks/compass/stylesheets/compass/css3/_gradient.scss @@ -37,7 +37,7 @@ $background: unquote(""); @if $image { $background : $image + unquote(", "); } $start: unquote($start); - $end: grad-opposite-position($start); + $end: opposite-position($start); @if $experimental-support-for-webkit { background-image: #{$background}-webkit-gradient(linear, grad-point($start), grad-point($end), grad-color-stops($color-stops)); } diff --git a/frameworks/compass/stylesheets/compass/reset/_utilities.scss b/frameworks/compass/stylesheets/compass/reset/_utilities.scss index e68eba2f..d9ba6d9c 100644 --- a/frameworks/compass/stylesheets/compass/reset/_utilities.scss +++ b/frameworks/compass/stylesheets/compass/reset/_utilities.scss @@ -104,7 +104,7 @@ // This reset provides a basic reset for html5 elements // so they are rendered correctly in browsers that don't recognize them. @mixin reset-html5 { - section, article, aside, header, footer, nav, dialog, figure { + article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary { display: block; } } // Resets the display of inline and block elements to their default display diff --git a/frameworks/compass/stylesheets/compass/utilities/_lists.scss b/frameworks/compass/stylesheets/compass/utilities/_lists.scss index 66dcfefe..3365f30a 100644 --- a/frameworks/compass/stylesheets/compass/utilities/_lists.scss +++ b/frameworks/compass/stylesheets/compass/utilities/_lists.scss @@ -1,3 +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/utilities/general/_clearfix.scss b/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss index ecc65a96..2c097cc1 100644 --- a/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss +++ b/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss @@ -18,12 +18,9 @@ // [Easy Clearing](http://www.positioniseverything.net/easyclearing.html) // has the advantage of allowing positioned elements to hang // outside the bounds of the container at the expense of more tricky CSS. -// -// This method of clearing might cause a gap at the bottom of the page in -// some browsers when used on the last element of the page. @mixin pie-clearfix { &:after { - content : " "; + content : "\0020"; display : block; height : 0; clear : both; diff --git a/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss b/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss index d30dd722..4f6ec87d 100644 --- a/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +++ b/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss @@ -1,12 +1,32 @@ +// The `zoom` approach generates less CSS but does not validate. +// Set this to `block` to use the display-property to hack the +// element to gain layout. +$default-has-layout-approach: zoom !default; + // This mixin causes an element matching the selector // to gain the "hasLayout" property in internet explorer. // More information on [hasLayout](http://reference.sitepoint.com/css/haslayout). -@mixin has-layout { +@mixin has-layout($using: $default-has-layout-approach) { + @if $using == zoom { + @include has-layout-zoom; + } @else if $using == block { + @include has-layout-block; + } @else { + @warn "Unknown has-layout approach: #{$using}"; + @include has-layout-zoom; + } +} + +@mixin has-layout-zoom { + *zoom: 1; +} + +@mixin has-layout-block { // This makes ie6 get layout display: inline-block; // and this puts it back to block - & { - display: block; } } + & { display: block; } +} // A hack to supply IE6 (and below) with a different property value. // [Read more](http://www.cssportal.com/css-hacks/#in_css-important). diff --git a/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss b/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss index a1c9d99f..5e98b718 100644 --- a/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss +++ b/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal-list.scss @@ -16,6 +16,7 @@ // +horizontal-list-item @import "bullets"; +@import "compass/utilities/general/clearfix"; @import "compass/utilities/general/reset"; @import "compass/utilities/general/float"; @@ -31,21 +32,21 @@ // :last-child is not fully supported // see http://www.quirksmode.org/css/contents.html#t29 for the support matrix -@mixin horizontal-list-item($padding: 4px) { +@mixin horizontal-list-item($padding: 4px, $direction: left) { @include no-bullet; white-space: nowrap; - @include float-left; + @include float($direction); padding: { left: $padding; - right: $padding; }; - &:first-child, &.first { - padding-left: 0px; } - &:last-child, &.last { - padding-right: 0px; } } + right: $padding; + }; + &:first-child, &.first { padding-#{$direction}: 0px; } + &:last-child, &.last { padding-#{opposite-position($direction)}: 0px; } +} // 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. -@mixin horizontal-list($padding: 4px) { +@mixin horizontal-list($padding: 4px, $direction: left) { @include horizontal-list-container; li { - @include horizontal-list-item($padding); } } + @include horizontal-list-item($padding, $direction); } } diff --git a/frameworks/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss b/frameworks/compass/stylesheets/compass/utilities/lists/_inline-block-list.scss new file mode 100644 index 00000000..907d443a --- /dev/null +++ b/frameworks/compass/stylesheets/compass/utilities/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/utilities/lists/_inline-list.scss b/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss index 329b5b30..6a26f1b4 100644 --- a/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss +++ b/frameworks/compass/stylesheets/compass/utilities/lists/_inline-list.scss @@ -2,18 +2,17 @@ @mixin inline-list { list-style-type: none; - margin: 0px; - padding: 0px; - display: inline; - li { + &, & li { margin: 0px; padding: 0px; - display: inline; } } + 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. +// 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. @@ -22,8 +21,9 @@ @mixin comma-delimited-list { @include inline-list; li { - &:after { - content: ", "; } + &:after { content: ", "; } &:last-child, &.last { - &:after { - content: ""; } } } } + &:after { content: ""; } + } + } +} diff --git a/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss b/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss index f265ebb8..041f1053 100644 --- a/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss +++ b/frameworks/compass/stylesheets/compass/utilities/text/_replacement.scss @@ -26,7 +26,9 @@ // Hides text in an element so you can see the background. @mixin hide-text { - text-indent: -9999em; + $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/lib/compass/app_integration/rails.rb b/lib/compass/app_integration/rails.rb index d1f370ae..87ba573f 100644 --- a/lib/compass/app_integration/rails.rb +++ b/lib/compass/app_integration/rails.rb @@ -34,6 +34,13 @@ module Compass end end + def initialize! + config_file = Compass.detect_configuration_file(root) + Compass.add_project_configuration(config_file) + Compass.discover_extensions! + Compass.configure_sass_plugin! + Compass.handle_configuration_change! + end end end end diff --git a/lib/compass/app_integration/rails/actionpack2/urls.rb b/lib/compass/app_integration/rails/actionpack2/urls.rb index f7eb3432..1847a722 100644 --- a/lib/compass/app_integration/rails/actionpack2/urls.rb +++ b/lib/compass/app_integration/rails/actionpack2/urls.rb @@ -1,8 +1,12 @@ module Compass::SassExtensions::Functions::Urls - def image_url_with_rails_integration(path) + def image_url_with_rails_integration(path, only_path = Sass::Script::Bool.new(false)) if (@controller = Sass::Plugin.rails_controller) && @controller.respond_to?(:request) && @controller.request begin - Sass::Script::String.new "url(#{image_path(path.value)})" + if only_path.to_bool + Sass::Script::String.new image_path(path.value) + else + Sass::Script::String.new "url(#{image_path(path.value)})" + end ensure @controller = nil end diff --git a/lib/compass/app_integration/rails/installer.rb b/lib/compass/app_integration/rails/installer.rb index 9652c0e3..2c6682a1 100644 --- a/lib/compass/app_integration/rails/installer.rb +++ b/lib/compass/app_integration/rails/installer.rb @@ -19,19 +19,16 @@ module Compass def write_configuration_files(config_file = nil) config_file ||= targetize('config/compass.rb') - directory File.dirname(config_file) - write_file config_file, config_contents + unless File.exists?(config_file) + directory File.dirname(config_file) + write_file config_file, config_contents + end directory File.dirname(targetize('config/initializers/compass.rb')) write_file targetize('config/initializers/compass.rb'), initializer_contents end - def config_files_exist? - File.exists?(targetize('config/compass.rb')) && - File.exists?(targetize('config/initializers/compass.rb')) - end - def prepare - write_configuration_files unless config_files_exist? + write_configuration_files end def finalize(options = {}) @@ -55,10 +52,12 @@ Sass will automatically compile your stylesheets during the next page request and keep them up to date when they change. NEXTSTEPS end - if manifest.has_stylesheet? - puts "\nNext add these lines to the head of your layouts:\n\n" - puts stylesheet_links - puts "\n(You are using haml, aren't you?)" + unless options[:prepare] + if manifest.has_stylesheet? + puts "\nNext add these lines to the head of your layouts:\n\n" + puts stylesheet_links + puts "\n(You are using haml, aren't you?)" + end end end @@ -105,10 +104,8 @@ NEXTSTEPS def initializer_contents %Q{require 'compass' - |rails_root = (defined?(Rails) ? Rails.root : RAILS_ROOT).to_s - |Compass.add_project_configuration(File.join(rails_root, "config", "compass.rb")) - |Compass.configure_sass_plugin! - |Compass.handle_configuration_change! + |require 'compass/app_integration/rails' + |Compass::AppIntegration::Rails.initialize! |}.gsub(/^\s+\|/,'') end diff --git a/lib/compass/commands/create_project.rb b/lib/compass/commands/create_project.rb index c714b023..ebebd507 100644 --- a/lib/compass/commands/create_project.rb +++ b/lib/compass/commands/create_project.rb @@ -43,7 +43,12 @@ module Compass self.options[:preferred_syntax] = syntax end + opts.on("--prepare", "Prepare the project by only creating configuration files.") do + self.options[:prepare] = true + end + super + end end diff --git a/lib/compass/commands/project_stats.rb b/lib/compass/commands/project_stats.rb index 81f958c9..7e7987a0 100644 --- a/lib/compass/commands/project_stats.rb +++ b/lib/compass/commands/project_stats.rb @@ -33,13 +33,14 @@ module Compass require 'compass/stats' compiler = new_compiler_instance sass_files = sorted_sass_files(compiler) + total_label = "Total (#{sass_files.size} files):" rows = [[ :-, :-, :-, :-, :-, :-, :- ], [ 'Filename', 'Rules', 'Properties', 'Mixins Defs', 'Mixins Used', 'CSS Rules', 'CSS Properties' ], [ :-, :-, :-, :-, :-, :-, :- ]] - maximums = [ 8, 5, 10, 14, 11, 9, 14 ] + maximums = [ total_label.length, 5, 10, 14, 11, 9, 14 ] alignments = [ :left, :right, :right, :right, :right, :right, :right ] delimiters = [ ['| ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'], [' ', ' |'] ] - totals = [ "Total (#{sass_files.size} files):", 0, 0, 0, 0, 0, 0 ] + totals = [ total_label, 0, 0, 0, 0, 0, 0 ] sass_files.each do |sass_file| css_file = compiler.corresponding_css_file(sass_file) unless sass_file[0..0] == '_' diff --git a/lib/compass/commands/stamp_pattern.rb b/lib/compass/commands/stamp_pattern.rb index 0af1acf3..d2a164a5 100644 --- a/lib/compass/commands/stamp_pattern.rb +++ b/lib/compass/commands/stamp_pattern.rb @@ -72,9 +72,9 @@ Options: # all commands must implement perform def perform installer.init - installer.run(:skip_finalization => true) + installer.run(:skip_finalization => true, :skip_preparation => !is_project_creation?) UpdateProject.new(working_path, options).perform if installer.compilation_required? - installer.finalize(:create => is_project_creation?) + installer.finalize(options.merge(:create => is_project_creation?)) end def is_project_creation? diff --git a/lib/compass/commands/update_project.rb b/lib/compass/commands/update_project.rb index 24ebb190..1d84185e 100644 --- a/lib/compass/commands/update_project.rb +++ b/lib/compass/commands/update_project.rb @@ -53,8 +53,8 @@ module Compass :dry_run => options[:dry_run]) compiler_opts.merge!(additional_options) Compass::Compiler.new(working_path, - projectize(Compass.configuration.sass_dir), - projectize(Compass.configuration.css_dir), + Compass.configuration.sass_path, + Compass.configuration.css_path, compiler_opts) end diff --git a/lib/compass/configuration/data.rb b/lib/compass/configuration/data.rb index 5c9354c1..8ae6afa2 100644 --- a/lib/compass/configuration/data.rb +++ b/lib/compass/configuration/data.rb @@ -25,7 +25,7 @@ module Compass extend Compass::Configuration::Paths inherited_accessor *ATTRIBUTES - inherited_accessor :required_libraries #XXX we should make this array add up cumulatively. + inherited_accessor :required_libraries, :loaded_frameworks, :framework_path #XXX we should make these arrays add up cumulatively. strip_trailing_separator *ATTRIBUTES.select{|a| a.to_s =~ /dir|path/} @@ -95,6 +95,16 @@ module Compass super end + def load(framework_dir) + (self.loaded_frameworks ||= []) << framework_dir + Compass::Frameworks.register_directory framework_dir + end + + def discover(frameworks_dir) + (self.framework_path ||= []) << frameworks_dir + Compass::Frameworks.discover frameworks_dir + end + def relative_assets? # the http_images_path is deprecated, but here for backwards compatibility. relative_assets || http_images_path == :relative diff --git a/lib/compass/configuration/defaults.rb b/lib/compass/configuration/defaults.rb index 73e54da7..db63bd3e 100644 --- a/lib/compass/configuration/defaults.rb +++ b/lib/compass/configuration/defaults.rb @@ -44,43 +44,43 @@ module Compass def default_sass_path if (pp = top_level.project_path) && (dir = top_level.sass_dir) - File.join(pp, dir) + Compass.projectize(dir, pp) end end def default_css_path if (pp = top_level.project_path) && (dir = top_level.css_dir) - File.join(pp, dir) + Compass.projectize(dir, pp) end end def default_images_path if (pp = top_level.project_path) && (dir = top_level.images_dir) - File.join(pp, dir) + Compass.projectize(dir, pp) end end def default_javascripts_path if (pp = top_level.project_path) && (dir = top_level.javascripts_dir) - File.join(pp, dir) + Compass.projectize(dir, pp) end end def default_extensions_path if (pp = top_level.project_path) && (dir = top_level.extensions_dir) - File.join(pp, dir) + Compass.projectize(dir, pp) end end def default_fonts_path if (pp = top_level.project_path) && (dir = top_level.fonts_dir) - File.join(pp, dir) + Compass.projectize(dir, pp) end end def default_cache_path if (pp = top_level.project_path) && (dir = top_level.cache_dir) - File.join(pp, dir) + Compass.projectize(dir, pp) end end diff --git a/lib/compass/configuration/serialization.rb b/lib/compass/configuration/serialization.rb index 902e7556..1301c379 100644 --- a/lib/compass/configuration/serialization.rb +++ b/lib/compass/configuration/serialization.rb @@ -56,6 +56,12 @@ module Compass (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| diff --git a/lib/compass/exec.rb b/lib/compass/exec.rb index 08b15e8e..0d49b8e7 100644 --- a/lib/compass/exec.rb +++ b/lib/compass/exec.rb @@ -6,6 +6,7 @@ require 'compass/actions' require 'compass/installers' require 'compass/commands' require 'rbconfig' +require 'pathname' begin require 'win32console' if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ rescue LoadError diff --git a/lib/compass/exec/global_options_parser.rb b/lib/compass/exec/global_options_parser.rb index c3ad7f1a..0f52225b 100644 --- a/lib/compass/exec/global_options_parser.rb +++ b/lib/compass/exec/global_options_parser.rb @@ -7,9 +7,24 @@ module Compass::Exec::GlobalOptionsParser opts.on('-r LIBRARY', '--require LIBRARY', "Require the given ruby LIBRARY before running commands.", " This is used to access compass plugins without having a", - " project configuration file.") do |library| - ::Compass.configuration.require library - end + " project configuration file." + ) do |library| + ::Compass.configuration.require library + end + + opts.on('-l FRAMEWORK_DIR', '--load FRAMEWORK_DIR', + "Load the framework or extensions found in the FRAMEWORK directory." + ) do |framework_dir| + require 'pathname' + ::Compass.configuration.load Pathname.new(framework_dir).realpath + end + + opts.on('-L FRAMEWORKS_DIR', '--load-all FRAMEWORKS_DIR', + "Load all the frameworks or extensions found in the FRAMEWORKS_DIR directory." + ) do |frameworks_dir| + require 'pathname' + ::Compass.configuration.discover Pathname.new(frameworks_dir).realpath + end opts.on('-q', '--quiet', :NONE, 'Quiet mode.') do self.options[:quiet] = true diff --git a/lib/compass/exec/project_options_parser.rb b/lib/compass/exec/project_options_parser.rb index 6ef5471a..571e200e 100644 --- a/lib/compass/exec/project_options_parser.rb +++ b/lib/compass/exec/project_options_parser.rb @@ -3,6 +3,14 @@ module Compass::Exec::ProjectOptionsParser super set_project_options(opts) end + def set_dir_or_path(type, dir) + if Pathname.new(dir).absolute? + self.options[:"#{type}_path"] = dir.tr('\\','/') + else + self.options[:"#{type}_dir"] = dir.tr('\\','/') + end + end + def set_project_options(opts) opts.on('-c', '--config CONFIG_FILE', 'Specify the location of the configuration file explicitly.') do |configuration_file| self.options[:configuration_file] = configuration_file @@ -13,19 +21,19 @@ module Compass::Exec::ProjectOptionsParser end opts.on('--sass-dir SRC_DIR', "The source directory where you keep your sass stylesheets.") do |sass_dir| - self.options[:sass_dir] = sass_dir + set_dir_or_path(:sass, sass_dir) end opts.on('--css-dir CSS_DIR', "The target directory where you keep your css stylesheets.") do |css_dir| - self.options[:css_dir] = css_dir + set_dir_or_path(:css, css_dir) end opts.on('--images-dir IMAGES_DIR', "The directory where you keep your images.") do |images_dir| - self.options[:images_dir] = images_dir + set_dir_or_path(:images, images_dir) end opts.on('--javascripts-dir JS_DIR', "The directory where you keep your javascripts.") do |javascripts_dir| - self.options[:javascripts_dir] = javascripts_dir + set_dir_or_path(:javascripts, javascripts_dir) end opts.on('-e ENV', '--environment ENV', [:development, :production], 'Use sensible defaults for your current environment.', diff --git a/lib/compass/installers/base.rb b/lib/compass/installers/base.rb index 36c5f3ab..36c23d6d 100644 --- a/lib/compass/installers/base.rb +++ b/lib/compass/installers/base.rb @@ -28,10 +28,10 @@ module Compass # Runs the installer. # Every installer must conform to the installation strategy of prepare, install, and then finalize. # A default implementation is provided for each step. - def run(options = {}) - prepare - install - finalize(options) unless options[:skip_finalization] + def run(run_options = {}) + prepare unless run_options[:skip_preparation] + install unless options[:prepare] + finalize(options.merge(run_options)) unless options[:prepare] || run_options[:skip_finalization] end # The default prepare method -- it is a no-op. @@ -116,6 +116,19 @@ module Compass "#{pattern_name_as_dir}#{to}" end + def install_directory(from, to, options) + d = if within = options[:within] + if respond_to?(within) + targetize("#{send(within)}/#{to}") + else + raise Compass::Error, "Unrecognized location: #{within}" + end + else + targetize(to) + end + directory d + end + alias install_html_without_haml install_html def install_html(from, to, options) if to =~ /\.haml$/ diff --git a/lib/compass/installers/manifest.rb b/lib/compass/installers/manifest.rb index 4324be66..b5faf022 100644 --- a/lib/compass/installers/manifest.rb +++ b/lib/compass/installers/manifest.rb @@ -20,7 +20,19 @@ module Compass parse(manifest_file) if manifest_file end - def self.type(t) + def self.known_extensions + @known_extensions ||= {} + end + + def self.plural_types + @plural_types ||= {} + end + + def self.type(t, options = {}) + Array(options[:extensions]).each do |ext| + self.known_extensions[ext] = t + end + self.plural_types[options[:plural]] = t if options[:plural] eval <<-END def #{t}(from, options = {}) @entries << Entry.new(:#{t}, from, options) @@ -34,12 +46,35 @@ module Compass END end - type :stylesheet - type :image - type :javascript - type :font - type :file - type :html + type :stylesheet, :plural => :stylesheets, :extensions => %w(scss sass) + type :image, :plural => :images, :extensions => %w(png gif jpg jpeg tiff gif) + type :javascript, :plural => :javascripts, :extensions => %w(js) + type :font, :plural => :fonts, :extensions => %w(otf woff ttf) + type :html, :plural => :html, :extensions => %w(html haml) + type :file, :plural => :files + type :directory, :plural => :directories + + def discover(type) + type = self.class.plural_types[type] || type + dir = File.dirname(@manifest_file) + Dir.glob("#{dir}/**/*").each do |file| + next if /manifest\.rb/ =~ file + short_name = file[(dir.length+1)..-1] + options = {} + ext = if File.extname(short_name) == ".erb" + options[:erb] = true + File.extname(short_name[0..-5]) + else + File.extname(short_name) + end[1..-1] + file_type = self.class.known_extensions[ext] + file_type = :file if file_type.nil? + file_type = :directory if File.directory?(file) + if type == :all || type == file_type + send(file_type, short_name, options) + end + end + end def help(value = nil) if value @@ -95,13 +130,23 @@ module Compass @compile_after_generation = false end + def with_manifest(manifest_file) + @manifest_file = manifest_file + yield + ensure + @manifest_file = nil + end + # parses a manifest file which is a ruby script # evaluated in a Manifest instance context def parse(manifest_file) - open(manifest_file) do |f| - eval(f.read, instance_binding, manifest_file) + with_manifest(manifest_file) do + open(manifest_file) do |f| + eval(f.read, instance_binding, manifest_file) + end end end + def instance_binding binding end diff --git a/lib/compass/installers/manifest_installer.rb b/lib/compass/installers/manifest_installer.rb index d48ff5ad..04e1d909 100644 --- a/lib/compass/installers/manifest_installer.rb +++ b/lib/compass/installers/manifest_installer.rb @@ -17,9 +17,11 @@ module Compass # Initializes the project to work with compass def init dirs = manifest.map do |entry| - loc = send("install_location_for_#{entry.type}", entry.to, entry.options) - File.dirname(loc) - end + unless entry.type == :directory + loc = send("install_location_for_#{entry.type}", entry.to, entry.options) + File.dirname(loc) + end + end.compact if manifest.has_stylesheet? dirs << sass_dir diff --git a/lib/compass/sass_extensions/functions.rb b/lib/compass/sass_extensions/functions.rb index cc827748..007cfc92 100644 --- a/lib/compass/sass_extensions/functions.rb +++ b/lib/compass/sass_extensions/functions.rb @@ -1,7 +1,11 @@ module Compass::SassExtensions::Functions end -%w(selectors enumerate urls display inline_image image_size gradient_support font_files).each do |func| +%w( + selectors enumerate urls display + inline_image image_size gradient_support + font_files constants lists +).each do |func| require "compass/sass_extensions/functions/#{func}" end @@ -14,6 +18,8 @@ module Sass::Script::Functions include Compass::SassExtensions::Functions::ImageSize include Compass::SassExtensions::Functions::GradientSupport::Functions include Compass::SassExtensions::Functions::FontFiles + include Compass::SassExtensions::Functions::Constants + include Compass::SassExtensions::Functions::Lists end # Wierd that this has to be re-included to pick up sub-modules. Ruby bug? diff --git a/lib/compass/sass_extensions/functions/constants.rb b/lib/compass/sass_extensions/functions/constants.rb new file mode 100644 index 00000000..4f3e34f8 --- /dev/null +++ b/lib/compass/sass_extensions/functions/constants.rb @@ -0,0 +1,17 @@ +module Compass::SassExtensions::Functions::Constants + # returns the opposite position of a side or corner. + def opposite_position(position) + opposite = position.value.split(/ +/).map do |pos| + case pos + when "top" then "bottom" + when "bottom" then "top" + when "left" then "right" + when "right" then "left" + when "center" then "center" + else + raise Sass::SyntaxError, "Cannot determine the opposite of #{pos}" + end + end + Sass::Script::String.new(opposite.join(" "), position.type) + end +end diff --git a/lib/compass/sass_extensions/functions/gradient_support.rb b/lib/compass/sass_extensions/functions/gradient_support.rb index 16b3b8b4..90112c04 100644 --- a/lib/compass/sass_extensions/functions/gradient_support.rb +++ b/lib/compass/sass_extensions/functions/gradient_support.rb @@ -36,22 +36,6 @@ module Compass::SassExtensions::Functions::GradientSupport end module Functions - # returns the opposite position of a side or corner. - def grad_opposite_position(position) - opposite = position.value.split(/ +/).map do |pos| - case pos - when "top" then "bottom" - when "bottom" then "top" - when "left" then "right" - when "right" then "left" - when "center" then "center" - else - raise Sass::SyntaxError, "Cannot determine the opposite of #{pos}" - end - end - Sass::Script::String.new(opposite.join(" ")) - end - # returns color-stop() calls for use in webkit. def grad_color_stops(color_list) assert_list(color_list) diff --git a/lib/compass/sass_extensions/functions/inline_image.rb b/lib/compass/sass_extensions/functions/inline_image.rb index 257de327..59dd60a7 100644 --- a/lib/compass/sass_extensions/functions/inline_image.rb +++ b/lib/compass/sass_extensions/functions/inline_image.rb @@ -1,4 +1,3 @@ -require 'base64' module Compass::SassExtensions::Functions::InlineImage def inline_image(path, mime_type = nil) @@ -10,19 +9,18 @@ module Compass::SassExtensions::Functions::InlineImage def inline_font_files(*args) raise Sass::SyntaxError, "An even number of arguments must be passed to font_files()" unless args.size % 2 == 0 - path = path.value files = [] while args.size > 0 path = args.shift.value real_path = File.join(Compass.configuration.fonts_path, path) - url = "url('data:#{compute_mime_type(path,mime_type)};base64,#{data(real_path)}')" + url = "url('data:#{compute_mime_type(path)};base64,#{data(real_path)}')" files << "#{url} format('#{args.shift}')" end Sass::Script::String.new(files.join(", ")) end private - def compute_mime_type(path, mime_type) + def compute_mime_type(path, mime_type = nil) return mime_type if mime_type case path when /\.png$/i @@ -48,7 +46,7 @@ private def data(real_path) if File.readable?(real_path) - Base64.encode64(File.read(real_path)).gsub("\n","") + [File.open(real_path, "rb") {|io| io.read}].pack('m').gsub("\n","") else raise Compass::Error, "File not found or cannot be read: #{real_path}" end diff --git a/lib/compass/sass_extensions/functions/lists.rb b/lib/compass/sass_extensions/functions/lists.rb new file mode 100644 index 00000000..663890b8 --- /dev/null +++ b/lib/compass/sass_extensions/functions/lists.rb @@ -0,0 +1,9 @@ +module Compass::SassExtensions::Functions::Lists + def first_value_of(list) + if list.is_a?(Sass::Script::String) + Sass::Script::String.new(list.value.split(/\s+/).first) + else + list + end + end +end diff --git a/lib/compass/sass_extensions/functions/urls.rb b/lib/compass/sass_extensions/functions/urls.rb index e6bb217d..615c4a91 100644 --- a/lib/compass/sass_extensions/functions/urls.rb +++ b/lib/compass/sass_extensions/functions/urls.rb @@ -1,20 +1,25 @@ module Compass::SassExtensions::Functions::Urls - def stylesheet_url(path) + def stylesheet_url(path, only_path = Sass::Script::Bool.new(false)) # Compute the path to the stylesheet, either root relative or stylesheet relative # or nil if the http_images_path is not set in the configuration. http_stylesheets_path = if relative? - compute_relative_path(Compass.configuration.css_dir) + compute_relative_path(Compass.configuration.css_path) elsif Compass.configuration.http_stylesheets_path Compass.configuration.http_stylesheets_path else Compass.configuration.http_root_relative(Compass.configuration.css_dir) end - clean_url("#{http_stylesheets_path}/#{path}") + path = "#{http_stylesheets_path}/#{path}" + if only_path.to_bool + Sass::Script::String.new(clean_path(path)) + else + clean_url(path) + end end - def font_url(path) + def font_url(path, only_path = Sass::Script::Bool.new(false)) path = path.value # get to the string value of the literal. # Short curcuit if they have provided an absolute url. @@ -25,26 +30,36 @@ module Compass::SassExtensions::Functions::Urls # Compute the path to the font file, either root relative or stylesheet relative # or nil if the http_fonts_path cannot be determined from the configuration. http_fonts_path = if relative? - compute_relative_path(Compass.configuration.fonts_dir) + compute_relative_path(Compass.configuration.fonts_path) else Compass.configuration.http_fonts_path end - clean_url("#{http_fonts_path}/#{path}") + path = "#{http_fonts_path}/#{path}" + + if only_path.to_bool + Sass::Script::String.new(clean_path(path)) + else + clean_url(path) + end end - def image_url(path) + def image_url(path, only_path = Sass::Script::Bool.new(false)) path = path.value # get to the string value of the literal. - # Short curcuit if they have provided an absolute url. - if absolute_path?(path) + if path =~ %r{^#{Regexp.escape(Compass.configuration.http_images_path)}/(.*)} + # Treat root relative urls (without a protocol) like normal if they start with + # the images path. + path = $1 + elsif absolute_path?(path) + # Short curcuit if they have provided an absolute url. return Sass::Script::String.new("url(#{path})") end # Compute the path to the image, either root relative or stylesheet relative # or nil if the http_images_path is not set in the configuration. http_images_path = if relative? - compute_relative_path(Compass.configuration.images_dir) + compute_relative_path(Compass.configuration.images_path) elsif Compass.configuration.http_images_path Compass.configuration.http_images_path else @@ -75,16 +90,24 @@ module Compass::SassExtensions::Functions::Urls # prepend the asset host if there is one. path = "#{asset_host}#{'/' unless path[0..0] == "/"}#{path}" if asset_host - clean_url(path) + if only_path.to_bool + Sass::Script::String.new(clean_path(path)) + else + clean_url(path) + end end private - # Emits a url, taking off any leading "./" - def clean_url(url) + # Emits a path, taking off any leading "./" + def clean_path(url) url = url.to_s url = url[0..1] == "./" ? url[2..-1] : url - Sass::Script::String.new("url('#{url}')") + end + + # Emits a url, taking off any leading "./" + def clean_url(url) + Sass::Script::String.new("url('#{clean_path(url)}')") end def relative? @@ -95,9 +118,8 @@ module Compass::SassExtensions::Functions::Urls path[0..0] == "/" || path[0..3] == "http" end - def compute_relative_path(dir) + def compute_relative_path(path) if (target_css_file = options[:css_filename]) - path = File.join(Compass.configuration.project_path, dir) Pathname.new(path).relative_path_from(Pathname.new(File.dirname(target_css_file))).to_s end end diff --git a/lib/compass/stats.rb b/lib/compass/stats.rb index 5bf7bddc..243b42af 100644 --- a/lib/compass/stats.rb +++ b/lib/compass/stats.rb @@ -11,7 +11,7 @@ module Compass def visit(node) self.prop_count += 1 if node.is_a?(Sass::Tree::PropNode) && !node.children.any? if node.is_a?(Sass::Tree::RuleNode) - self.rule_count += node.rule.map{|r| r.split(/,/)}.flatten.compact.size + self.rule_count += node.rule.reject{|r| r.is_a?(Sass::Script::Node)}.map{|r| r.split(/,/)}.flatten.compact.size end self.mixin_def_count += 1 if node.is_a?(Sass::Tree::MixinDefNode) self.mixin_count += 1 if node.is_a?(Sass::Tree::MixinNode) diff --git a/lib/compass/validator.rb b/lib/compass/validator.rb index 606f3420..adb9b9d8 100644 --- a/lib/compass/validator.rb +++ b/lib/compass/validator.rb @@ -4,6 +4,6 @@ begin rescue LoadError raise Compass::MissingDependency, %Q{The Compass CSS Validator could not be loaded. Please install it: -sudo gem install chriseppstein-compass-validator --source http://gems.github.com/ +sudo gem install compass-validator } end diff --git a/test/fixtures/stylesheets/blueprint/css/screen.css b/test/fixtures/stylesheets/blueprint/css/screen.css index 365ced83..e6722f0f 100644 --- a/test/fixtures/stylesheets/blueprint/css/screen.css +++ b/test/fixtures/stylesheets/blueprint/css/screen.css @@ -200,9 +200,7 @@ caption { .clearfix { overflow: hidden; - display: inline-block; } - .clearfix { - display: block; } + *zoom: 1; } .small { font-size: 0.8em; @@ -234,9 +232,7 @@ caption { width: 950px; margin: 0 auto; overflow: hidden; - display: inline-block; } - .container { - display: block; } + *zoom: 1; } .column, div.span-1, div.span-2, div.span-3, div.span-4, div.span-5, div.span-6, div.span-7, div.span-8, div.span-9, div.span-10, div.span-11, div.span-12, div.span-13, div.span-14, div.span-15, div.span-16, div.span-17, div.span-18, div.span-19, div.span-20, div.span-21, div.span-22, div.span-23, div.span-24 { display: inline; @@ -726,7 +722,7 @@ legend { font-weight: bold; font-size: 1.2em; } -input.text, input.title, input[type=text], input[type=password] { +input.text, input.title, input[type=email], input[type=text], input[type=password] { margin: 0.5em 0; background-color: white; padding: 5px; } @@ -746,14 +742,14 @@ select { fieldset { border: 1px solid #cccccc; } -input.text, input.title, input[type=text], input[type=password], +input.text, input.title, input[type=email], input[type=text], input[type=password], textarea, select { border: 1px solid #bbbbbb; } - input.text:focus, input.title:focus, input[type=text]:focus, input[type=password]:focus, + input.text:focus, input.title:focus, input[type=email]:focus, input[type=text]:focus, input[type=password]:focus, textarea:focus, select:focus { border: 1px solid #666666; } -input.text, input.title, input[type=text], input[type=password] { +input.text, input.title, input[type=email], input[type=text], input[type=password] { width: 300px; } textarea { diff --git a/test/fixtures/stylesheets/blueprint/css/single-imports/form.css b/test/fixtures/stylesheets/blueprint/css/single-imports/form.css index 0f1134bf..53269641 100644 --- a/test/fixtures/stylesheets/blueprint/css/single-imports/form.css +++ b/test/fixtures/stylesheets/blueprint/css/single-imports/form.css @@ -11,7 +11,7 @@ form.bp fieldset { form.bp legend { font-weight: bold; font-size: 1.2em; } -form.bp input.text, form.bp input.title, form.bp input[type=text], form.bp input[type=password] { +form.bp input.text, form.bp input.title, form.bp input[type=email], form.bp input[type=text], form.bp input[type=password] { margin: 0.5em 0; background-color: white; padding: 5px; } @@ -27,13 +27,13 @@ form.bp select { margin: 0.5em 0; } form.bp fieldset { border: 1px solid #cccccc; } -form.bp input.text, form.bp input.title, form.bp input[type=text], form.bp input[type=password], +form.bp input.text, form.bp input.title, form.bp input[type=email], form.bp input[type=text], form.bp input[type=password], form.bp textarea, form.bp select { border: 1px solid #bbbbbb; } - form.bp input.text:focus, form.bp input.title:focus, form.bp input[type=text]:focus, form.bp input[type=password]:focus, + form.bp input.text:focus, form.bp input.title:focus, form.bp input[type=email]:focus, form.bp input[type=text]:focus, form.bp input[type=password]:focus, form.bp textarea:focus, form.bp select:focus { border: 1px solid #666666; } -form.bp input.text, form.bp input.title, form.bp input[type=text], form.bp input[type=password] { +form.bp input.text, form.bp input.title, form.bp input[type=email], form.bp input[type=text], form.bp input[type=password] { width: 300px; } form.bp textarea { width: 390px; diff --git a/test/fixtures/stylesheets/blueprint/css/single-imports/grid.css b/test/fixtures/stylesheets/blueprint/css/single-imports/grid.css index 4e8405ca..e1fe71e7 100644 --- a/test/fixtures/stylesheets/blueprint/css/single-imports/grid.css +++ b/test/fixtures/stylesheets/blueprint/css/single-imports/grid.css @@ -2,9 +2,7 @@ width: 950px; margin: 0 auto; overflow: hidden; - display: inline-block; } - .container { - display: block; } + *zoom: 1; } .column, div.span-1, div.span-2, div.span-3, div.span-4, div.span-5, div.span-6, div.span-7, div.span-8, div.span-9, div.span-10, div.span-11, div.span-12, div.span-13, div.span-14, div.span-15, div.span-16, div.span-17, div.span-18, div.span-19, div.span-20, div.span-21, div.span-22, div.span-23, div.span-24 { display: inline; diff --git a/test/fixtures/stylesheets/blueprint/css/single-imports/liquid.css b/test/fixtures/stylesheets/blueprint/css/single-imports/liquid.css index 7ab93d66..a7f9eb9e 100644 --- a/test/fixtures/stylesheets/blueprint/css/single-imports/liquid.css +++ b/test/fixtures/stylesheets/blueprint/css/single-imports/liquid.css @@ -3,9 +3,7 @@ width: 80%; margin: 0 auto; overflow: hidden; - display: inline-block; } - .container { - display: block; } + *zoom: 1; } .span-1 { width: 3.167%; } diff --git a/test/fixtures/stylesheets/blueprint/css/single-imports/rtl.css b/test/fixtures/stylesheets/blueprint/css/single-imports/rtl.css index 95fc5963..74c9af24 100644 --- a/test/fixtures/stylesheets/blueprint/css/single-imports/rtl.css +++ b/test/fixtures/stylesheets/blueprint/css/single-imports/rtl.css @@ -3,9 +3,7 @@ margin: 0 auto; direction: rtl; overflow: hidden; - display: inline-block; } - .container { - display: block; } + *zoom: 1; } .column, div.span-1, div.span-2, div.span-3, div.span-4, div.span-5, div.span-6, div.span-7, div.span-8, div.span-9, div.span-10, div.span-11, div.span-12, div.span-13, div.span-14, div.span-15, div.span-16, div.span-17, div.span-18, div.span-19, div.span-20, div.span-21, div.span-22, div.span-23, div.span-24 { display: inline; diff --git a/test/fixtures/stylesheets/blueprint/css/single-imports/scaffolding.css b/test/fixtures/stylesheets/blueprint/css/single-imports/scaffolding.css index 5f947943..5a86c02f 100644 --- a/test/fixtures/stylesheets/blueprint/css/single-imports/scaffolding.css +++ b/test/fixtures/stylesheets/blueprint/css/single-imports/scaffolding.css @@ -42,4 +42,4 @@ form.inline { margin-bottom: 0; } body { - margin: 1.5em 0; } \ No newline at end of file + margin: 1.5em 0; } diff --git a/test/fixtures/stylesheets/blueprint/css/single-imports/utilities.css b/test/fixtures/stylesheets/blueprint/css/single-imports/utilities.css index 7fc1cd5d..88d3ba30 100644 --- a/test/fixtures/stylesheets/blueprint/css/single-imports/utilities.css +++ b/test/fixtures/stylesheets/blueprint/css/single-imports/utilities.css @@ -6,9 +6,7 @@ .clearfix { overflow: hidden; - display: inline-block; } - .clearfix { - display: block; } + *zoom: 1; } .small { font-size: 0.8em; diff --git a/test/fixtures/stylesheets/compass/config.rb b/test/fixtures/stylesheets/compass/config.rb index 1b3ad842..141d3aed 100644 --- a/test/fixtures/stylesheets/compass/config.rb +++ b/test/fixtures/stylesheets/compass/config.rb @@ -7,3 +7,8 @@ output_style = :nested # To enable relative image paths using the images_url() function: # http_images_path = :relative http_images_path = "/images" +line_comments = false + +asset_cache_buster do |path, file| + "busted=true" +end diff --git a/test/fixtures/stylesheets/compass/css/border_radius.css b/test/fixtures/stylesheets/compass/css/border_radius.css new file mode 100644 index 00000000..5eef9e03 --- /dev/null +++ b/test/fixtures/stylesheets/compass/css/border_radius.css @@ -0,0 +1,23 @@ +.simple { + -webkit-border-radius: 4px 4px; + -moz-border-radius: 4px / 4px; + -o-border-radius: 4px / 4px; + -ms-border-radius: 4px / 4px; + -khtml-border-radius: 4px / 4px; + border-radius: 4px / 4px; } + +.compound { + -webkit-border-radius: 2px 3px; + -moz-border-radius: 2px 5px / 3px 6px; + -o-border-radius: 2px 5px / 3px 6px; + -ms-border-radius: 2px 5px / 3px 6px; + -khtml-border-radius: 2px 5px / 3px 6px; + border-radius: 2px 5px / 3px 6px; } + +.crazy { + -webkit-border-radius: 1px 2px; + -moz-border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px; + -o-border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px; + -ms-border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px; + -khtml-border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px; + border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px; } diff --git a/test/fixtures/stylesheets/compass/css/fonts.css b/test/fixtures/stylesheets/compass/css/fonts.css new file mode 100644 index 00000000..596b9a06 --- /dev/null +++ b/test/fixtures/stylesheets/compass/css/fonts.css @@ -0,0 +1,3 @@ +@font-face { + font-family: "font1"; + src: local("☺"), url('/tmp/fonts/font1.woff') format('woff'); } diff --git a/test/fixtures/stylesheets/compass/css/gradients.css b/test/fixtures/stylesheets/compass/css/gradients.css index c45e29c4..2ac003fd 100644 --- a/test/fixtures/stylesheets/compass/css/gradients.css +++ b/test/fixtures/stylesheets/compass/css/gradients.css @@ -1,75 +1,94 @@ .linear-1 { background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%, #dddddd), color-stop(100%, #aaaaaa)); - background-image: -moz-linear-gradient(top, #dddddd 0%, #aaaaaa 100%); } + background-image: -moz-linear-gradient(top, #dddddd 0%, #aaaaaa 100%); + background-image: linear-gradient(top, #dddddd 0%, #aaaaaa 100%); } .linear-2 { background-image: -webkit-gradient(linear, 0% 0%, 100% 0%, color-stop(0%, #dddddd), color-stop(100%, #aaaaaa)); - background-image: -moz-linear-gradient(left, #dddddd 0%, #aaaaaa 100%); } + background-image: -moz-linear-gradient(left, #dddddd 0%, #aaaaaa 100%); + background-image: linear-gradient(left, #dddddd 0%, #aaaaaa 100%); } .linear-3 { background-image: -webkit-gradient(linear, 0% 0%, 100% 100%, color-stop(0%, #dddddd), color-stop(100%, #aaaaaa)); - background-image: -moz-linear-gradient(top left, #dddddd 0%, #aaaaaa 100%); } + background-image: -moz-linear-gradient(top left, #dddddd 0%, #aaaaaa 100%); + background-image: linear-gradient(top left, #dddddd 0%, #aaaaaa 100%); } .linear-4 { background-image: -webkit-gradient(linear, 100% 0%, 0% 100%, color-stop(0%, #dddddd), color-stop(100%, #aaaaaa)); - background-image: -moz-linear-gradient(top right, #dddddd 0%, #aaaaaa 100%); } + background-image: -moz-linear-gradient(top right, #dddddd 0%, #aaaaaa 100%); + background-image: linear-gradient(top right, #dddddd 0%, #aaaaaa 100%); } .linear-5 { background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%, #dddddd), color-stop(50%, #cccccc), color-stop(100%, #aaaaaa)); - background-image: -moz-linear-gradient(top, #dddddd 0%, #cccccc 50%, #aaaaaa 100%); } + background-image: -moz-linear-gradient(top, #dddddd 0%, #cccccc 50%, #aaaaaa 100%); + background-image: linear-gradient(top, #dddddd 0%, #cccccc 50%, #aaaaaa 100%); } .linear-6 { background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%, #dddddd), color-stop(20%, #cccccc), color-stop(100%, #aaaaaa)); - background-image: -moz-linear-gradient(top, #dddddd 0%, #cccccc 20%, #aaaaaa 100%); } + background-image: -moz-linear-gradient(top, #dddddd 0%, #cccccc 20%, #aaaaaa 100%); + background-image: linear-gradient(top, #dddddd 0%, #cccccc 20%, #aaaaaa 100%); } .linear-7 { background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%, #dddddd), color-stop(20%, #cccccc), color-stop(60%, #eeeeee), color-stop(100%, #aaaaaa)); - background-image: -moz-linear-gradient(top, #dddddd 0%, #cccccc 20%, #eeeeee 60%, #aaaaaa 100%); } + background-image: -moz-linear-gradient(top, #dddddd 0%, #cccccc 20%, #eeeeee 60%, #aaaaaa 100%); + background-image: linear-gradient(top, #dddddd 0%, #cccccc 20%, #eeeeee 60%, #aaaaaa 100%); } .linear-8 { background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(80%, #dddddd), color-stop(100%, #aaaaaa)); - background-image: -moz-linear-gradient(top, #dddddd 80%, #aaaaaa 100%); } + background-image: -moz-linear-gradient(top, #dddddd 80%, #aaaaaa 100%); + background-image: linear-gradient(top, #dddddd 80%, #aaaaaa 100%); } .linear-9 { background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(0%, #dddddd), color-stop(100%, #aaaaaa)); - background-image: -moz-linear-gradient(top, #dddddd 0%, #aaaaaa 20%); } + background-image: -moz-linear-gradient(top, #dddddd 0%, #aaaaaa 20%); + background-image: linear-gradient(top, #dddddd 0%, #aaaaaa 20%); } .linear-10 { background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(80%, #dddddd), color-stop(100%, #aaaaaa)); - background-image: -moz-linear-gradient(top, #dddddd 40%, #aaaaaa 50%); } + background-image: -moz-linear-gradient(top, #dddddd 40%, #aaaaaa 50%); + background-image: linear-gradient(top, #dddddd 40%, #aaaaaa 50%); } .linear-11 { background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(80%, #dddddd), color-stop(90%, #000000), color-stop(100%, #aaaaaa)); - background-image: -moz-linear-gradient(top, #dddddd 40%, #000000 45%, #aaaaaa 50%); } + background-image: -moz-linear-gradient(top, #dddddd 40%, #000000 45%, #aaaaaa 50%); + background-image: linear-gradient(top, #dddddd 40%, #000000 45%, #aaaaaa 50%); } .radial-1 { background-image: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 100, color-stop(0%, #dddddd), color-stop(100%, #aaaaaa)); - background-image: -moz-radial-gradient(center center, circle, #dddddd 0%, #aaaaaa 100%); } + background-image: -moz-radial-gradient(center center, circle, #dddddd 0%, #aaaaaa 100%); + background-image: radial-gradient(center center, circle, #dddddd 0%, #aaaaaa 100%); } .radial-2 { background-image: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 100, color-stop(0%, #dddddd), color-stop(100%, #aaaaaa)); - background-image: -moz-radial-gradient(center center, circle, #dddddd 0%, #aaaaaa 100%); } + background-image: -moz-radial-gradient(center center, circle, #dddddd 0%, #aaaaaa 100%); + background-image: radial-gradient(center center, circle, #dddddd 0%, #aaaaaa 100%); } .radial-3 { background-image: -webkit-gradient(radial, 50% 0%, 0, 50% 0%, 100, color-stop(0%, #dddddd), color-stop(100%, #aaaaaa)); - background-image: -moz-radial-gradient(top center, circle, #dddddd 0%, #aaaaaa 100%); } + background-image: -moz-radial-gradient(top center, circle, #dddddd 0%, #aaaaaa 100%); + background-image: radial-gradient(top center, circle, #dddddd 0%, #aaaaaa 100%); } .radial-4 { background-image: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 100, color-stop(0%, #dddddd), color-stop(100%, #aaaaaa)); - background-image: -moz-radial-gradient(center center, circle, #dddddd 0%, #aaaaaa 100%); } + background-image: -moz-radial-gradient(center center, circle, #dddddd 0%, #aaaaaa 100%); + background-image: radial-gradient(center center, circle, #dddddd 0%, #aaaaaa 100%); } .radial-5 { background-image: -webkit-gradient(radial, 50% 0%, 0, 50% 0%, 100, color-stop(0%, #dddddd), color-stop(100%, #aaaaaa)); - background-image: -moz-radial-gradient(top center, circle, #dddddd 0%, #aaaaaa 100%); } + background-image: -moz-radial-gradient(top center, circle, #dddddd 0%, #aaaaaa 100%); + background-image: radial-gradient(top center, circle, #dddddd 0%, #aaaaaa 100%); } .radial-6 { background-image: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 50, color-stop(40%, #dddddd), color-stop(100%, #aaaaaa)); - background-image: -moz-radial-gradient(center center, circle, #dddddd 20px, #aaaaaa 50px); } + background-image: -moz-radial-gradient(center center, circle, #dddddd 20px, #aaaaaa 50px); + background-image: radial-gradient(center center, circle, #dddddd 20px, #aaaaaa 50px); } .radial-7 { background-image: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 50, color-stop(20%, #dddddd), color-stop(100%, #aaaaaa)); - background-image: -moz-radial-gradient(center center, circle, #dddddd 20%, #aaaaaa 50px); } + background-image: -moz-radial-gradient(center center, circle, #dddddd 20%, #aaaaaa 50px); + background-image: radial-gradient(center center, circle, #dddddd 20%, #aaaaaa 50px); } .alpha-linear { background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(80%, rgba(255, 255, 255, 0)), color-stop(90%, rgba(255, 127, 127, 0.5)), color-stop(100%, #ffffff)); - background-image: -moz-linear-gradient(top, rgba(255, 255, 255, 0) 40%, rgba(255, 127, 127, 0.5) 45%, #ffffff 50%); } + background-image: -moz-linear-gradient(top, rgba(255, 255, 255, 0) 40%, rgba(255, 127, 127, 0.5) 45%, #ffffff 50%); + background-image: linear-gradient(top, rgba(255, 255, 255, 0) 40%, rgba(255, 127, 127, 0.5) 45%, #ffffff 50%); } diff --git a/test/fixtures/stylesheets/compass/css/images.css b/test/fixtures/stylesheets/compass/css/images.css new file mode 100644 index 00000000..e0c4fdae --- /dev/null +++ b/test/fixtures/stylesheets/compass/css/images.css @@ -0,0 +1,8 @@ +.relative { + background-image: url('/images/4x6.png?busted=true'); } + +.root-relative { + background-image: url('/images/4x6.png?busted=true'); } + +.absolute { + background-image: url(http://example.com/images/4x6.png); } diff --git a/test/fixtures/stylesheets/compass/css/legacy_clearfix.css b/test/fixtures/stylesheets/compass/css/legacy_clearfix.css new file mode 100644 index 00000000..2a287628 --- /dev/null +++ b/test/fixtures/stylesheets/compass/css/legacy_clearfix.css @@ -0,0 +1,17 @@ +.clearfix { + overflow: hidden; + display: inline-block; } + .clearfix { + display: block; } + +.pie-clearfix { + display: inline-block; } + .pie-clearfix:after { + content: "\0020"; + display: block; + height: 0; + clear: both; + overflow: hidden; + visibility: hidden; } + .pie-clearfix { + display: block; } diff --git a/test/fixtures/stylesheets/compass/css/lists.css b/test/fixtures/stylesheets/compass/css/lists.css new file mode 100644 index 00000000..d4d6a68c --- /dev/null +++ b/test/fixtures/stylesheets/compass/css/lists.css @@ -0,0 +1,134 @@ +ul.horizontal { + margin: 0; + padding: 0; + border: 0; + outline: 0; + overflow: hidden; + *zoom: 1; } + ul.horizontal li { + list-style-image: none; + list-style-type: none; + margin-left: 0px; + white-space: nowrap; + display: inline; + float: left; + padding-left: 4px; + padding-right: 4px; } + ul.horizontal li:first-child, ul.horizontal li.first { + padding-left: 0px; } + ul.horizontal li:last-child, ul.horizontal li.last { + padding-right: 0px; } + +ul.wide-horizontal { + margin: 0; + padding: 0; + border: 0; + outline: 0; + overflow: hidden; + *zoom: 1; } + ul.wide-horizontal li { + list-style-image: none; + list-style-type: none; + margin-left: 0px; + white-space: nowrap; + display: inline; + float: left; + padding-left: 10px; + padding-right: 10px; } + ul.wide-horizontal li:first-child, ul.wide-horizontal li.first { + padding-left: 0px; } + ul.wide-horizontal li:last-child, ul.wide-horizontal li.last { + padding-right: 0px; } + +ul.right-horizontal { + margin: 0; + padding: 0; + border: 0; + outline: 0; + overflow: hidden; + *zoom: 1; } + ul.right-horizontal li { + list-style-image: none; + list-style-type: none; + margin-left: 0px; + white-space: nowrap; + display: inline; + float: right; + padding-left: 4px; + padding-right: 4px; } + ul.right-horizontal li:first-child, ul.right-horizontal li.first { + padding-right: 0px; } + ul.right-horizontal li:last-child, ul.right-horizontal li.last { + padding-left: 0px; } + +ul.inline-block { + margin: 0; + padding: 0; + border: 0; + outline: 0; + overflow: hidden; + *zoom: 1; } + ul.inline-block li { + list-style-image: none; + list-style-type: none; + margin-left: 0px; + display: -moz-inline-box; + -moz-box-orient: vertical; + display: inline-block; + vertical-align: middle; + *display: inline; + *vertical-align: auto; + white-space: nowrap; } + +ul.wide-inline-block { + margin: 0; + padding: 0; + border: 0; + outline: 0; + overflow: hidden; + *zoom: 1; } + ul.wide-inline-block li { + list-style-image: none; + list-style-type: none; + margin-left: 0px; + display: -moz-inline-box; + -moz-box-orient: vertical; + display: inline-block; + vertical-align: middle; + *display: inline; + *vertical-align: auto; + white-space: nowrap; + padding-left: 10px; + padding-right: 10px; } + +ul.inline { + list-style-type: none; } + ul.inline, ul.inline li { + margin: 0px; + padding: 0px; + display: inline; } + +ul.comma { + list-style-type: none; } + ul.comma, ul.comma li { + margin: 0px; + padding: 0px; + display: inline; } + ul.comma li:after { + content: ", "; } + ul.comma li:last-child:after, ul.comma li.last:after { + content: ""; } + +ul.no-bullets { + list-style: none; } + ul.no-bullets li { + list-style-image: none; + list-style-type: none; + margin-left: 0px; } + +ul.pretty { + margin-left: 0; } + ul.pretty li { + padding-left: 14px; + background: url('/images/4x6.png?busted=true') no-repeat 4px 7px; + list-style-type: none; } diff --git a/test/fixtures/stylesheets/compass/css/utilities.css b/test/fixtures/stylesheets/compass/css/utilities.css index b8b12855..38544f92 100644 --- a/test/fixtures/stylesheets/compass/css/utilities.css +++ b/test/fixtures/stylesheets/compass/css/utilities.css @@ -1,17 +1,13 @@ .clearfix { overflow: hidden; - display: inline-block; } - .clearfix { - display: block; } + *zoom: 1; } .pie-clearfix { - display: inline-block; } + *zoom: 1; } .pie-clearfix:after { - content: " "; + content: "\0020"; display: block; height: 0; clear: both; overflow: hidden; visibility: hidden; } - .pie-clearfix { - display: block; } diff --git a/test/fixtures/stylesheets/compass/images/4x6.png b/test/fixtures/stylesheets/compass/images/4x6.png new file mode 100644 index 00000000..1c57ddfe Binary files /dev/null and b/test/fixtures/stylesheets/compass/images/4x6.png differ diff --git a/test/fixtures/stylesheets/compass/sass/border_radius.scss b/test/fixtures/stylesheets/compass/sass/border_radius.scss new file mode 100644 index 00000000..685ad4cc --- /dev/null +++ b/test/fixtures/stylesheets/compass/sass/border_radius.scss @@ -0,0 +1,5 @@ +@import "compass/css3/border-radius"; + +.simple { @include border-radius(4px, 4px); } +.compound { @include border-radius(2px 5px, 3px 6px); } +.crazy { @include border-radius(1px 3px 5px 7px, 2px 4px 6px 8px)} diff --git a/test/fixtures/stylesheets/compass/sass/fonts.sass b/test/fixtures/stylesheets/compass/sass/fonts.sass new file mode 100644 index 00000000..fdbef5b5 --- /dev/null +++ b/test/fixtures/stylesheets/compass/sass/fonts.sass @@ -0,0 +1,3 @@ +@import compass/css3/font-face + ++font-face("font1", font-files("font1.woff", woff)) \ No newline at end of file diff --git a/test/fixtures/stylesheets/compass/sass/images.scss b/test/fixtures/stylesheets/compass/sass/images.scss new file mode 100644 index 00000000..65d583f3 --- /dev/null +++ b/test/fixtures/stylesheets/compass/sass/images.scss @@ -0,0 +1,9 @@ +.relative { + background-image: image-url("4x6.png"); +} +.root-relative { + background-image: image-url("/images/4x6.png"); +} +.absolute { + background-image: image-url("http://example.com/images/4x6.png"); +} \ No newline at end of file diff --git a/test/fixtures/stylesheets/compass/sass/legacy_clearfix.scss b/test/fixtures/stylesheets/compass/sass/legacy_clearfix.scss new file mode 100644 index 00000000..5a9f6396 --- /dev/null +++ b/test/fixtures/stylesheets/compass/sass/legacy_clearfix.scss @@ -0,0 +1,11 @@ +$default-has-layout-approach: block; + +@import "compass/utilities"; + +.clearfix { + @include clearfix; +} + +.pie-clearfix { + @include pie-clearfix; +} diff --git a/test/fixtures/stylesheets/compass/sass/lists.scss b/test/fixtures/stylesheets/compass/sass/lists.scss new file mode 100644 index 00000000..bdbc3788 --- /dev/null +++ b/test/fixtures/stylesheets/compass/sass/lists.scss @@ -0,0 +1,11 @@ +@import "compass/utilities/lists"; + +ul.horizontal { @include horizontal-list; } +ul.wide-horizontal { @include horizontal-list(10px); } +ul.right-horizontal { @include horizontal-list(4px, right); } +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.no-bullets { @include no-bullets; } +ul.pretty { @include pretty-bullets("4x6.png"); } \ No newline at end of file diff --git a/test/rails_helper.rb b/test/rails_helper.rb index d8b47a17..11a743d9 100644 --- a/test/rails_helper.rb +++ b/test/rails_helper.rb @@ -19,13 +19,18 @@ module Compass end else begin - require 'rails/version' - require 'rails_generator' - require 'rails_generator/scripts/generate' - Rails::Generator::Base.use_application_sources! - capture_output do - Rails::Generator::Base.logger = Rails::Generator::SimpleLogger.new $stdout - Rails::Generator::Scripts::Generate.new.run([name], :generator => 'app') + require 'action_pack/version' + if ActionPack::VERSION::MAJOR >= 3 + `rails new #{name}` + else + require 'rails/version' + require 'rails_generator' + require 'rails_generator/scripts/generate' + Rails::Generator::Base.use_application_sources! + capture_output do + Rails::Generator::Base.logger = Rails::Generator::SimpleLogger.new $stdout + Rails::Generator::Scripts::Generate.new.run([name], :generator => 'app') + end end rescue LoadError Kernel.exit!(2)