autoprefixer-rails 0.4.20130521 → 0.4.20130523

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -12,6 +12,9 @@
12
12
  * Add Firefox 23 data.
13
13
  * Update css-parse to fix @-moz-document issue.
14
14
 
15
+ 20130523:
16
+ * Update Rework’s libraries to fix @page statement.
17
+
15
18
  == 0.3 (Growing Strong)
16
19
  * Use own filters instead of Rework’s `prefix` and `prefixValue`.
17
20
  * Smarter value prefixer without false match “order” in “border”.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- autoprefixer-rails (0.4.20130521)
4
+ autoprefixer-rails (0.4.20130523)
5
5
  execjs
6
6
 
7
7
  GEM
@@ -1,3 +1,3 @@
1
1
  module AutoprefixerRails
2
- VERSION = '0.4.20130521'.freeze unless defined? AutoprefixerRails::VERSION
2
+ VERSION = '0.4.20130523'.freeze unless defined? AutoprefixerRails::VERSION
3
3
  end
@@ -208,7 +208,12 @@ module.exports = function(css){
208
208
  */
209
209
 
210
210
  function stylesheet() {
211
- return { stylesheet: { rules: rules() }};
211
+ return {
212
+ type: 'stylesheet',
213
+ stylesheet: {
214
+ rules: rules()
215
+ }
216
+ };
212
217
  }
213
218
 
214
219
  /**
@@ -267,8 +272,8 @@ module.exports = function(css){
267
272
  */
268
273
 
269
274
  function comments(rules) {
270
- rules = rules || [];
271
275
  var c;
276
+ rules = rules || [];
272
277
  while (c = comment()) rules.push(c);
273
278
  return rules;
274
279
  }
@@ -278,15 +283,20 @@ module.exports = function(css){
278
283
  */
279
284
 
280
285
  function comment() {
281
- if ('/' == css[0] && '*' == css[1]) {
282
- var i = 2;
283
- while ('*' != css[i] || '/' != css[i + 1]) ++i;
284
- i += 2;
285
- var comment = css.slice(2, i - 2);
286
- css = css.slice(i);
287
- whitespace();
288
- return { comment: comment };
289
- }
286
+ if ('/' != css[0] || '*' != css[1]) return;
287
+
288
+ var i = 2;
289
+ while (null != css[i] && ('*' != css[i] || '/' != css[i + 1])) ++i;
290
+ i += 2;
291
+
292
+ var str = css.slice(2, i - 2);
293
+ css = css.slice(i);
294
+ whitespace();
295
+
296
+ return {
297
+ type: 'comment',
298
+ comment: str
299
+ };
290
300
  }
291
301
 
292
302
  /**
@@ -320,7 +330,32 @@ module.exports = function(css){
320
330
  // ;
321
331
  match(/^[;\s]*/);
322
332
 
323
- return { property: prop, value: val };
333
+ return {
334
+ type: 'declaration',
335
+ property: prop,
336
+ value: val
337
+ };
338
+ }
339
+
340
+ /**
341
+ * Parse declarations.
342
+ */
343
+
344
+ function declarations() {
345
+ var decls = [];
346
+
347
+ if (!open()) return;
348
+ comments(decls);
349
+
350
+ // declarations
351
+ var decl;
352
+ while (decl = declaration()) {
353
+ decls.push(decl);
354
+ comments(decls);
355
+ }
356
+
357
+ if (!close()) return;
358
+ return decls;
324
359
  }
325
360
 
326
361
  /**
@@ -339,6 +374,7 @@ module.exports = function(css){
339
374
  if (!vals.length) return;
340
375
 
341
376
  return {
377
+ type: 'keyframe',
342
378
  values: vals,
343
379
  declarations: declarations()
344
380
  };
@@ -371,6 +407,7 @@ module.exports = function(css){
371
407
  if (!close()) return;
372
408
 
373
409
  return {
410
+ type: 'keyframes',
374
411
  name: name,
375
412
  vendor: vendor,
376
413
  keyframes: frames
@@ -393,7 +430,11 @@ module.exports = function(css){
393
430
 
394
431
  if (!close()) return;
395
432
 
396
- return { supports: supports, rules: style };
433
+ return {
434
+ type: 'supports',
435
+ supports: supports,
436
+ rules: style
437
+ };
397
438
  }
398
439
 
399
440
  /**
@@ -412,7 +453,11 @@ module.exports = function(css){
412
453
 
413
454
  if (!close()) return;
414
455
 
415
- return { media: media, rules: style };
456
+ return {
457
+ type: 'media',
458
+ media: media,
459
+ rules: style
460
+ };
416
461
  }
417
462
 
418
463
  /**
@@ -431,7 +476,7 @@ module.exports = function(css){
431
476
 
432
477
  // declarations
433
478
  var decl;
434
- while (decl = declaration() || atmargin()) {
479
+ while (decl = declaration()) {
435
480
  decls.push(decl);
436
481
  comments();
437
482
  }
@@ -439,7 +484,7 @@ module.exports = function(css){
439
484
  if (!close()) return;
440
485
 
441
486
  return {
442
- type: "page",
487
+ type: 'page',
443
488
  selectors: sel,
444
489
  declarations: decls
445
490
  };
@@ -463,33 +508,19 @@ module.exports = function(css){
463
508
  if (!close()) return;
464
509
 
465
510
  return {
511
+ type: 'document',
466
512
  document: doc,
467
513
  vendor: vendor,
468
514
  rules: style
469
515
  };
470
516
  }
471
517
 
472
- /**
473
- * Parse margin at-rules
474
- */
475
-
476
- function atmargin() {
477
- var m = match(/^@([a-z\-]+) */);
478
- if (!m) return;
479
- var type = m[1]
480
-
481
- return {
482
- type: type,
483
- declarations: declarations()
484
- }
485
- }
486
-
487
518
  /**
488
519
  * Parse import
489
520
  */
490
521
 
491
522
  function atimport() {
492
- return _atrule('import')
523
+ return _atrule('import');
493
524
  }
494
525
 
495
526
  /**
@@ -515,32 +546,11 @@ module.exports = function(css){
515
546
  function _atrule(name) {
516
547
  var m = match(new RegExp('^@' + name + ' *([^;\\n]+);\\s*'));
517
548
  if (!m) return;
518
- var ret = {}
549
+ var ret = { type: name };
519
550
  ret[name] = m[1].trim();
520
551
  return ret;
521
552
  }
522
553
 
523
- /**
524
- * Parse declarations.
525
- */
526
-
527
- function declarations() {
528
- var decls = [];
529
-
530
- if (!open()) return;
531
- comments();
532
-
533
- // declarations
534
- var decl;
535
- while (decl = declaration()) {
536
- decls.push(decl);
537
- comments();
538
- }
539
-
540
- if (!close()) return;
541
- return decls;
542
- }
543
-
544
554
  /**
545
555
  * Parse at rule.
546
556
  */
@@ -564,7 +574,11 @@ module.exports = function(css){
564
574
  var sel = selector();
565
575
  if (!sel) return;
566
576
  comments();
567
- return { selectors: sel, declarations: declarations() };
577
+ return {
578
+ type: 'rule',
579
+ selectors: sel,
580
+ declarations: declarations()
581
+ };
568
582
  }
569
583
 
570
584
  return stylesheet();
@@ -610,6 +624,8 @@ Compiler.prototype.compile = function(node){
610
624
  */
611
625
 
612
626
  Compiler.prototype.visit = function(node){
627
+ if ('page' == node.type) return this.page(node);
628
+ if (node.document) return this.document(node);
613
629
  if (node.comment) return this.comment(node);
614
630
  if (node.charset) return this.charset(node);
615
631
  if (node.keyframes) return this.keyframes(node);
@@ -657,6 +673,28 @@ Compiler.prototype.media = function(node){
657
673
  + '\n}';
658
674
  };
659
675
 
676
+ /**
677
+ * Visit document node.
678
+ */
679
+
680
+ Compiler.prototype.document = function(node){
681
+ var doc = '@' + (node.vendor || '') + 'document ' + node.document;
682
+
683
+ if (this.compress) {
684
+ return doc
685
+ + '{'
686
+ + node.rules.map(this.visit, this).join('')
687
+ + '}';
688
+ }
689
+
690
+ return doc + ' '
691
+ + ' {\n'
692
+ + this.indent(1)
693
+ + node.rules.map(this.visit, this).join('\n\n')
694
+ + this.indent(-1)
695
+ + '\n}';
696
+ };
697
+
660
698
  /**
661
699
  * Visit charset node.
662
700
  */
@@ -716,6 +754,19 @@ Compiler.prototype.keyframe = function(node){
716
754
  + '\n' + this.indent() + '}\n';
717
755
  };
718
756
 
757
+ /**
758
+ * Visit page node.
759
+ */
760
+
761
+ Compiler.prototype.page = function(node){
762
+ return '@page ' + node.selectors.join(', ')
763
+ + ' {\n'
764
+ + this.indent(1)
765
+ + node.declarations.map(this.declaration, this).join(';\n')
766
+ + this.indent(-1)
767
+ + '\n}';
768
+ };
769
+
719
770
  /**
720
771
  * Visit rule node.
721
772
  */
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.4.20130521
4
+ version: 0.4.20130523
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-05-21 00:00:00.000000000 Z
12
+ date: 2013-05-23 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: 628132571511562849
85
+ hash: 2538313319073258649
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: 628132571511562849
94
+ hash: 2538313319073258649
95
95
  requirements: []
96
96
  rubyforge_project:
97
97
  rubygems_version: 1.8.23