diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..c111b33137 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.gem diff --git a/.travis.yml b/.travis.yml index f797cba1e9..4fc8ae831f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ rvm: - ree - 2.0.0 - 2.1.0 + - 2.2.0 sudo: false diff --git a/Rakefile b/Rakefile index 137b321065..f7dd771aca 100644 --- a/Rakefile +++ b/Rakefile @@ -11,6 +11,31 @@ task :test do end end +desc "build gems" +task :build_gems => [:test] do + GEMS.each do |gem| + chdir gem do + if gem == 'cli' + sh "gem build compass.gemspec" + else + sh "gem build compass-#{gem}.gemspec" + end + end + end +end + +desc "publish gems" +task :publish_gems => [:build_gems] do + GEMS.each do |gem| + chdir gem do + if gem == 'cli' + sh "gem push compass.gemspec" + else + sh "gem push compass-#{gem}.gemspec" + end + end + end +end desc "Clean up all test files" task :test_cleanup do diff --git a/cli/Gemfile b/cli/Gemfile index 7cd7182671..df432300b2 100644 --- a/cli/Gemfile +++ b/cli/Gemfile @@ -19,6 +19,7 @@ unless ENV['PKG'] gem 'rake' gem 'json', '~> 1.7.7', :platforms => :ruby_18 gem 'true', "~> 0.2.3" + gem 'test-unit', '~> 3.0.9' # Warning be carful adding OS dependant gems above this line it will break the CI server please # place them below so they are excluded diff --git a/cli/VERSION b/cli/VERSION index 7f207341d5..e4c0d46e55 100644 --- a/cli/VERSION +++ b/cli/VERSION @@ -1 +1 @@ -1.0.1 \ No newline at end of file +1.0.3 \ No newline at end of file diff --git a/cli/compass.gemspec b/cli/compass.gemspec index aff849ad7b..cfb799aa77 100644 --- a/cli/compass.gemspec +++ b/cli/compass.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |gemspec| Compass is charityware. If you love it, please donate on our behalf at http://umdf.org/compass Thanks! MESSAGE - gemspec.files = %w(LICENSE.markdown VERSION Rakefile) + gemspec.files = %w(LICENSE.markdown VERSION VERSION_NAME Rakefile) gemspec.files += Dir.glob("bin/*") gemspec.files += Dir.glob("data/**/*") gemspec.files += Dir.glob("frameworks/**/*") diff --git a/cli/lib/compass/sass_compiler.rb b/cli/lib/compass/sass_compiler.rb index 068471b739..588ad54dad 100644 --- a/cli/lib/compass/sass_compiler.rb +++ b/cli/lib/compass/sass_compiler.rb @@ -113,10 +113,11 @@ def when_deleting_sourcemap(filename) def when_compilation_error(error, sass_file, css_file, sourcemap_file) @error_count += 1 if error.respond_to?(:sass_filename) - if relativize(error.sass_filename) == relativize(sass_file) - logger.record :error, "#{relativize(error.sass_filename)} (Line #{error.sass_line}: #{error.message})" + error_filename = error.sass_filename || sass_file + if relativize(error_filename) == relativize(sass_file) + logger.record :error, "#{relativize(sass_file)} (Line #{error.sass_line}: #{error.message})" else - logger.record :error, "#{relativize(sass_file)} (Line #{error.sass_line} of #{relativize(error.sass_filename)}: #{error.message})" + logger.record :error, "#{relativize(sass_file)} (Line #{error.sass_line} of #{relativize(error_filename)}: #{error.message})" end else logger.record :error, "#{relativize(sass_file)} (#{error.backtrace.first}: #{error.message})" diff --git a/core/Gemfile b/core/Gemfile index 462c84b3bb..dc74daa1a6 100644 --- a/core/Gemfile +++ b/core/Gemfile @@ -7,3 +7,4 @@ gem 'pry' gem 'diff-lcs', '~> 1.1.2' gem 'true', "~> 0.2.3" gem 'timecop', "~> 0.5.9.2" +gem 'test-unit', '~> 3.0.9' diff --git a/core/VERSION b/core/VERSION index 7f207341d5..e6d5cb833c 100644 --- a/core/VERSION +++ b/core/VERSION @@ -1 +1 @@ -1.0.1 \ No newline at end of file +1.0.2 \ No newline at end of file diff --git a/core/lib/compass/core/caniuse.rb b/core/lib/compass/core/caniuse.rb index 7ff6652c32..8c7ee70155 100644 --- a/core/lib/compass/core/caniuse.rb +++ b/core/lib/compass/core/caniuse.rb @@ -69,7 +69,7 @@ def all_prefixes(browser) end # returns the prefixes needed by the list of browsers given - def prefixes(browsers = browsers) + def prefixes(browsers = browsers()) result = browsers.map{|b| all_prefixes(b) } result.flatten! result.uniq! diff --git a/core/lib/compass/core/sass_extensions/functions/inline_image.rb b/core/lib/compass/core/sass_extensions/functions/inline_image.rb index e8baa36c08..9cf4cf518b 100644 --- a/core/lib/compass/core/sass_extensions/functions/inline_image.rb +++ b/core/lib/compass/core/sass_extensions/functions/inline_image.rb @@ -1,3 +1,7 @@ +# Uncomment lines to enable `inline-svg-code-to-png` functionality +# require 'RMagick' +# include Magick + module Compass::Core::SassExtensions::Functions::InlineImage def inline_image(path, mime_type = nil) @@ -17,6 +21,21 @@ def inline_font_files(*args) list(files, :comma) end + def inline_svg_code(str) + code = str.value + + # Add the XML header (because it's a real drag adding it each time) + code = '' + code + + # Inline the SVG code + inline_svg_string(format_svg_code(code)) + end + + # def inline_svg_code_to_png(str) + # code = str.value + # inline_image_string(convert_svg_code_to_png(code), 'png') + # end + protected def inline_image_string(data, mime_type) data = [data].flatten.pack('m').gsub("\n","") @@ -24,6 +43,11 @@ def inline_image_string(data, mime_type) unquoted_string(url) end + def inline_svg_string(data) + url = "url('data:image/svg+xml,#{data}')" + unquoted_string(url) + end + private def compute_mime_type(path, mime_type = nil) return mime_type.value if mime_type @@ -60,4 +84,18 @@ def data(real_path) raise Compass::Error, "File not found or cannot be read: #{real_path}" end end + + def format_svg_code(code) + ERB::Util.url_encode(code) + end + + # def convert_svg_code_to_png(str) + # img, data = Magick::Image.from_blob(str) { + # self.format = 'SVG' + # self.background_color = 'transparent' + # } + # img.to_blob { + # self.format = 'PNG' + # } + # end end diff --git a/core/stylesheets/compass/_support.scss b/core/stylesheets/compass/_support.scss index 73caa3f1a8..baeda728cd 100644 --- a/core/stylesheets/compass/_support.scss +++ b/core/stylesheets/compass/_support.scss @@ -275,9 +275,9 @@ $css-sel2-support-threshold: $critical-usage-threshold !default; $old-range: map-get($ranges, $browser); @if $old-range { $old-min: nth($old-range, 1); - $old-max: nth($old-range, 2); + $old-max: if(length($old-range) == 1, $old-min, nth($old-range, 2)); $new-min: nth($new-range, 1); - $new-max: nth($new-range, 2); + $new-max: if(length($new-range) == 1, $new-min, nth($new-range, 2)); $maximin: if(compare-browser-versions($browser, $old-min, $new-min) > 0, $old-min, $new-min); $minimax: if(compare-browser-versions($browser, $old-max, $new-max) < 0, diff --git a/core/test/integrations/projects/compass/css/issue-1853.css b/core/test/integrations/projects/compass/css/issue-1853.css new file mode 100644 index 0000000000..8110c73e72 --- /dev/null +++ b/core/test/integrations/projects/compass/css/issue-1853.css @@ -0,0 +1,10 @@ +.use-case { + background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4gPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJncmFkIiBncmFkaWVudFVuaXRzPSJvYmplY3RCb3VuZGluZ0JveCIgeDE9IjAuNSIgeTE9IjAuMCIgeDI9IjAuNSIgeTI9IjEuMCI+PHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmMDAwMCIvPjxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwMDBmZiIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JhZCkiIC8+PC9zdmc+IA=='); + background-size: 100%; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ff0000), color-stop(100%, #0000ff)); + background-image: -moz-linear-gradient(#ff0000, #0000ff); + background-image: -webkit-linear-gradient(#ff0000, #0000ff); + background-image: linear-gradient(#ff0000, #0000ff); } + +.simple { + content: (ie: "9" "9"); } diff --git a/core/test/integrations/projects/compass/sass/issue-1853.scss b/core/test/integrations/projects/compass/sass/issue-1853.scss new file mode 100644 index 0000000000..bde6e20d4a --- /dev/null +++ b/core/test/integrations/projects/compass/sass/issue-1853.scss @@ -0,0 +1,16 @@ +@import "compass/support"; +@import "compass/css3/images"; + +// An actual use-case that demonstrates the problem +.use-case { + @include with-browser-ranges(css-mediaqueries) { + @include background-image(linear-gradient(red, blue)); + } +} + +// A simplification of the issue +$ranges: (ie: "9" "11"); +$new-ranges: (ie: "9"); +.simple { + content: inspect(intersect-browser-ranges($ranges, $new-ranges)); +} diff --git a/import-once/Gemfile b/import-once/Gemfile index fa75df1563..ef656e19a1 100644 --- a/import-once/Gemfile +++ b/import-once/Gemfile @@ -1,3 +1,5 @@ source 'https://rubygems.org' +gem 'test-unit', '~> 3.0.9' + gemspec