sassmagic 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/sassmagic/reset.rb +13 -3
  2. metadata +2 -2
@@ -519,9 +519,19 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
519
519
  #字符串替换px
520
520
  #'0 1px.jpg 1px 2px;3pxabc 4px'.scan(/([\.\d]+)+(px)+([;\s]+|$)/)
521
521
  #=> [["1", "px", " "], ["2", "px", ";"], ["4", "px", ""]]
522
- str.scan(/([\.\d]+)+(px)+([;\s]+|$)/i){ |c,v|
523
- if !(ignore.include? c+v) && (c != '1') && c =~ /^[^0]+/
524
- ret = ret.gsub(c.to_s,(format("%.3f",c.to_f/rem).to_f).to_s).gsub(v,'rem')
522
+ # str.scan(/([\.\d]+)+(px)+([;\s]+|$)/i){ |c,v|
523
+ # if !(ignore.include? c+v) && (c != '1') && c =~ /^[^0]+/
524
+ # ret = ret.gsub(c.to_s,(format("%.3f",c.to_f/rem).to_f).to_s).gsub(v,'rem')
525
+ # else
526
+ # # debugger
527
+ # ret = ret.gsub(/^0+/,'0').gsub(/(^0+)(\d+)/,'\2')
528
+ # # ret = ret.to_s.gsub(/(^0+)(\d+)/,'\2')
529
+ # end
530
+ # }
531
+ #修复bug '1px 1em' =>'.xrem .xem'
532
+ str.scan(/(([\.\d]+)+(px))+([;\s]+|$)/i){ |s,c,v|
533
+ if !(ignore.include? s) && (c != '1') && c =~ /^[^0]+/
534
+ ret = ret.gsub(s.to_s,(format("%.3f",c.to_f/rem).to_f).to_s + 'rem')
525
535
  else
526
536
  # debugger
527
537
  ret = ret.gsub(/^0+/,'0').gsub(/(^0+)(\d+)/,'\2')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sassmagic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-27 00:00:00.000000000 Z
12
+ date: 2015-05-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sass