autoprefixer-rails 0.5.20130615 → 0.5.20130616

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.
data/ChangeLog CHANGED
@@ -4,6 +4,11 @@
4
4
  * Fix a lot of CSS parsing errors.
5
5
  * Fix sass-rails 4.0.0.rc2 compatibility.
6
6
 
7
+ 20130616:
8
+ * More useful message for CSS parsing errors.
9
+ * Remove old WebKit gradient syntax.
10
+ * Fix parsing error on comment with braces.
11
+
7
12
  == 0.4 (Winter Is Coming)
8
13
  * Remove outdated prefixes.
9
14
  * Add border-radius and box-shadow properties to database.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- autoprefixer-rails (0.5.20130615)
4
+ autoprefixer-rails (0.5.20130616)
5
5
  execjs
6
6
 
7
7
  GEM
@@ -33,7 +33,15 @@ module AutoprefixerRails
33
33
  def self.install(assets, browsers = nil)
34
34
  assets.register_postprocessor 'text/css', :autoprefixer do |context, css|
35
35
  if defined?(Sass::Rails) and Sass::Rails::VERSION == '4.0.0.rc2'
36
- AutoprefixerRails.compile(css, browsers) rescue css
36
+ begin
37
+ AutoprefixerRails.compile(css, browsers)
38
+ rescue ExecJS::ProgramError => e
39
+ if e.message =~ /Can't parse CSS/
40
+ css
41
+ else
42
+ raise e
43
+ end
44
+ end
37
45
  else
38
46
  AutoprefixerRails.compile(css, browsers)
39
47
  end
@@ -1,3 +1,3 @@
1
1
  module AutoprefixerRails
2
- VERSION = '0.5.20130615'.freeze unless defined? AutoprefixerRails::VERSION
2
+ VERSION = '0.5.20130616'.freeze unless defined? AutoprefixerRails::VERSION
3
3
  end
@@ -1337,10 +1337,15 @@ require.register("autoprefixer/lib/autoprefixer.js", function(exports, require,
1337
1337
 
1338
1338
  autoprefixer = {
1339
1339
  compile: function(str, requirements) {
1340
- var nodes;
1341
- nodes = parse(this.fixIeComments(str));
1340
+ var nodes,
1341
+ _this = this;
1342
+ nodes = this.catchParseErrors(function() {
1343
+ return parse(_this.removeBadComments(str));
1344
+ });
1342
1345
  this.rework(requirements)(nodes.stylesheet);
1343
- return stringify(nodes);
1346
+ return this.catchParseErrors(function() {
1347
+ return stringify(nodes);
1348
+ });
1344
1349
  },
1345
1350
  rework: function(requirements) {
1346
1351
  var browsers, prefixes;
@@ -1357,8 +1362,8 @@ require.register("autoprefixer/lib/autoprefixer.js", function(exports, require,
1357
1362
  browsers: require('../data/browsers'),
1358
1363
  prefixes: require('../data/prefixes')
1359
1364
  },
1360
- fixIeComments: function(css) {
1361
- return css.replace(/\/\*[^\*]*\*\/\s*:/g, ':');
1365
+ removeBadComments: function(css) {
1366
+ return css.replace(/\/\*[^\*]*\*\/\s*:/g, ':').replace(/\/\*[^\*]*\{[^\*]*\*\//g, '');
1362
1367
  },
1363
1368
  inspect: function(requirements) {
1364
1369
  var browsers, prefixes;
@@ -1366,6 +1371,18 @@ require.register("autoprefixer/lib/autoprefixer.js", function(exports, require,
1366
1371
  prefixes = new Prefixes(this.data.prefixes, browsers);
1367
1372
  this.inspectFunc || (this.inspectFunc = require('./autoprefixer/inspect'));
1368
1373
  return this.inspectFunc(prefixes);
1374
+ },
1375
+ catchParseErrors: function(callback) {
1376
+ var e, error;
1377
+ try {
1378
+ return callback();
1379
+ } catch (_error) {
1380
+ e = _error;
1381
+ error = new Error("Can't parse CSS");
1382
+ error.stack = e.stack;
1383
+ error.css = true;
1384
+ throw error;
1385
+ }
1369
1386
  }
1370
1387
  };
1371
1388
 
@@ -1504,12 +1521,16 @@ require.register("autoprefixer/lib/autoprefixer/binary.js", function(exports, re
1504
1521
  prefixed = autoprefixer.compile(css, this.requirements);
1505
1522
  } catch (_error) {
1506
1523
  error = _error;
1507
- if (error.autoprefixer) {
1524
+ if (error.autoprefixer || error.css) {
1508
1525
  this.error("autoprefixer: " + error.message);
1509
1526
  } else {
1510
1527
  this.error('autoprefixer: Internal error');
1511
- this.error('');
1512
- this.error(error.stack);
1528
+ }
1529
+ if (error.css || !error.autoprefixer) {
1530
+ if (error.stack != null) {
1531
+ this.error('');
1532
+ this.error(error.stack);
1533
+ }
1513
1534
  }
1514
1535
  }
1515
1536
  if (!prefixed) {
@@ -1962,6 +1983,16 @@ require.register("autoprefixer/lib/autoprefixer/hacks/gradient.js", function(exp
1962
1983
  return "" + param + "deg";
1963
1984
  };
1964
1985
 
1986
+ Gradient.prototype.prefixed = function(prefix) {
1987
+ var type;
1988
+ if (prefix === '-webkit-') {
1989
+ type = this.name === 'linear-gradient' ? 'linear' : 'radial';
1990
+ return utils.regexp("-webkit-(" + type + "-gradient|gradient\\(\\s*" + type + ")", false);
1991
+ } else {
1992
+ return Gradient.__super__.prefixed.apply(this, arguments);
1993
+ }
1994
+ };
1995
+
1965
1996
  return Gradient;
1966
1997
 
1967
1998
  })(Value);
@@ -2470,8 +2501,14 @@ require.register("autoprefixer/lib/autoprefixer/utils.js", function(exports, req
2470
2501
  escapeRegexp: function(string) {
2471
2502
  return string.replace(/([.?*+\^\$\[\]\\(){}|\-])/g, "\\$1");
2472
2503
  },
2473
- regexp: function(word) {
2474
- return new RegExp('(^|\\s|,|\\()(' + this.escapeRegexp(word) + '($|\\s|\\(|,))', 'gi');
2504
+ regexp: function(word, escape) {
2505
+ if (escape == null) {
2506
+ escape = true;
2507
+ }
2508
+ if (escape) {
2509
+ word = this.escapeRegexp(word);
2510
+ }
2511
+ return new RegExp('(^|\\s|,|\\()(' + word + '($|\\s|\\(|,))', 'gi');
2475
2512
  }
2476
2513
  };
2477
2514
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoprefixer-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.20130615
4
+ version: 0.5.20130616
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: 2013-06-15 00:00:00.000000000 Z
12
+ date: 2013-06-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: execjs
@@ -82,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  segments:
84
84
  - 0
85
- hash: 2257296920152131795
85
+ hash: -740665598923324032
86
86
  required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  none: false
88
88
  requirements:
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  segments:
93
93
  - 0
94
- hash: 2257296920152131795
94
+ hash: -740665598923324032
95
95
  requirements: []
96
96
  rubyforge_project:
97
97
  rubygems_version: 1.8.23