autoprefixer-rails 0.8.20131213 → 1.0.20131222
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.
- checksums.yaml +4 -4
- data/{ChangeLog → ChangeLog.md} +68 -51
- data/Gemfile +6 -5
- data/LICENSE +20 -165
- data/README.md +50 -13
- data/autoprefixer-rails.gemspec +2 -2
- data/lib/autoprefixer-rails.rb +17 -41
- data/lib/autoprefixer-rails/processor.rb +90 -0
- data/lib/autoprefixer-rails/railtie.rb +0 -18
- data/lib/autoprefixer-rails/result.rb +20 -0
- data/lib/autoprefixer-rails/sprockets.rb +56 -0
- data/lib/autoprefixer-rails/version.rb +1 -1
- data/lib/rake/autoprefixer_tasks.rb +3 -21
- data/spec/app/app/assets/stylesheets/loaded.sass +2 -0
- data/spec/app/app/assets/stylesheets/sass.sass +1 -0
- data/spec/app/app/assets/stylesheets/wrong.css +1 -0
- data/spec/app/app/controllers/css_controller.rb +1 -1
- data/spec/app/config/application.rb +1 -1
- data/spec/app/config/routes.rb +1 -1
- data/spec/autoprefixer_spec.rb +36 -13
- data/spec/rails_spec.rb +8 -8
- data/spec/spec_helper.rb +5 -1
- data/vendor/autoprefixer.js +5639 -3755
- metadata +11 -6
- data/lib/autoprefixer-rails/compiler.rb +0 -74
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoprefixer-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.20131222
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey "A.I." Sitnik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|
@@ -31,25 +31,30 @@ extensions: []
|
|
31
31
|
extra_rdoc_files:
|
32
32
|
- README.md
|
33
33
|
- LICENSE
|
34
|
-
- ChangeLog
|
34
|
+
- ChangeLog.md
|
35
35
|
files:
|
36
36
|
- .gitignore
|
37
37
|
- .rspec
|
38
38
|
- .travis.yml
|
39
|
-
- ChangeLog
|
39
|
+
- ChangeLog.md
|
40
40
|
- Gemfile
|
41
41
|
- LICENSE
|
42
42
|
- README.md
|
43
43
|
- Rakefile
|
44
44
|
- autoprefixer-rails.gemspec
|
45
45
|
- lib/autoprefixer-rails.rb
|
46
|
-
- lib/autoprefixer-rails/
|
46
|
+
- lib/autoprefixer-rails/processor.rb
|
47
47
|
- lib/autoprefixer-rails/railtie.rb
|
48
|
+
- lib/autoprefixer-rails/result.rb
|
49
|
+
- lib/autoprefixer-rails/sprockets.rb
|
48
50
|
- lib/autoprefixer-rails/version.rb
|
49
51
|
- lib/rake/autoprefixer_tasks.rb
|
50
52
|
- spec/app/.gitignore
|
51
53
|
- spec/app/Rakefile
|
54
|
+
- spec/app/app/assets/stylesheets/loaded.sass
|
55
|
+
- spec/app/app/assets/stylesheets/sass.sass
|
52
56
|
- spec/app/app/assets/stylesheets/test.css
|
57
|
+
- spec/app/app/assets/stylesheets/wrong.css
|
53
58
|
- spec/app/app/controllers/application_controller.rb
|
54
59
|
- spec/app/app/controllers/css_controller.rb
|
55
60
|
- spec/app/config.ru
|
@@ -67,7 +72,7 @@ files:
|
|
67
72
|
- vendor/autoprefixer.js
|
68
73
|
homepage: https://github.com/ai/autoprefixer-rails
|
69
74
|
licenses:
|
70
|
-
-
|
75
|
+
- MIT
|
71
76
|
metadata: {}
|
72
77
|
post_install_message:
|
73
78
|
rdoc_options: []
|
@@ -1,74 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
Copyright 2013 Andrey “A.I.” Sitnik <andrey@sitnik.ru>,
|
3
|
-
sponsored by Evil Martians.
|
4
|
-
|
5
|
-
This program is free software: you can redistribute it and/or modify
|
6
|
-
it under the terms of the GNU Lesser General Public License as published by
|
7
|
-
the Free Software Foundation, either version 3 of the License, or
|
8
|
-
(at your option) any later version.
|
9
|
-
|
10
|
-
This program is distributed in the hope that it will be useful,
|
11
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
GNU Lesser General Public License for more details.
|
14
|
-
|
15
|
-
You should have received a copy of the GNU Lesser General Public License
|
16
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
-
=end
|
18
|
-
|
19
|
-
require 'execjs'
|
20
|
-
|
21
|
-
module AutoprefixerRails
|
22
|
-
# Ruby to JS wrapper for Autoprefixer compiler instance
|
23
|
-
class Compiler
|
24
|
-
def initialize(browsers=nil)
|
25
|
-
@browsers = browsers || []
|
26
|
-
end
|
27
|
-
|
28
|
-
# Return prefixed `css`
|
29
|
-
def compile(css)
|
30
|
-
compiler.call('compile', css)
|
31
|
-
end
|
32
|
-
|
33
|
-
# Return, which browsers and prefixes will be used
|
34
|
-
def inspect
|
35
|
-
compiler.call('inspect')
|
36
|
-
end
|
37
|
-
|
38
|
-
# Lazy load for JS instance
|
39
|
-
def compiler
|
40
|
-
@compiler ||= ExecJS.compile(build_js)
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
# Cache autoprefixer.js content
|
46
|
-
def read_js
|
47
|
-
@@js ||= Pathname(__FILE__).join("../../../vendor/autoprefixer.js").read
|
48
|
-
end
|
49
|
-
|
50
|
-
# Return compiler JS with some extra methods
|
51
|
-
def build_js
|
52
|
-
read_js + create_instance + add_proxy('compile') + add_proxy('inspect')
|
53
|
-
end
|
54
|
-
|
55
|
-
# Return JS code to create Autoprefixer instance
|
56
|
-
def create_instance
|
57
|
-
if @browsers.empty?
|
58
|
-
"var compiler = autoprefixer;"
|
59
|
-
else
|
60
|
-
browsers = @browsers.map(&:to_s).join("', '")
|
61
|
-
"var compiler = autoprefixer('#{browsers}');"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
# Return JS code to create proxy methods
|
66
|
-
def add_proxy(func)
|
67
|
-
<<-JS
|
68
|
-
var #{ func } = function() {
|
69
|
-
return compiler.#{ func }.apply(compiler, arguments)
|
70
|
-
};
|
71
|
-
JS
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|