autoprefixer-rails 9.4.8 → 10.4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +185 -0
- data/README.md +25 -33
- data/lib/autoprefixer-rails/processor.rb +73 -109
- data/lib/autoprefixer-rails/railtie.rb +20 -15
- data/lib/autoprefixer-rails/result.rb +2 -0
- data/lib/autoprefixer-rails/sprockets.rb +16 -14
- data/lib/autoprefixer-rails/version.rb +4 -2
- data/lib/autoprefixer-rails.rb +16 -13
- data/lib/rake/autoprefixer_tasks.rb +6 -4
- data/vendor/autoprefixer.js +72694 -58965
- metadata +44 -49
- data/.gitignore +0 -7
- data/.rspec +0 -1
- data/.travis.yml +0 -25
- data/Gemfile +0 -9
- data/Rakefile +0 -48
- data/autoprefixer-rails.gemspec +0 -28
- data/spec/app/.browserslistrc +0 -4
- data/spec/app/.gitignore +0 -2
- data/spec/app/Rakefile +0 -2
- data/spec/app/app/assets/config/manifest.js +0 -0
- data/spec/app/app/assets/stylesheets/evaluate.css.erb +0 -1
- data/spec/app/app/assets/stylesheets/loaded.sass +0 -2
- data/spec/app/app/assets/stylesheets/sass.sass +0 -1
- data/spec/app/app/assets/stylesheets/test.css +0 -3
- data/spec/app/app/assets/stylesheets/wrong.css +0 -2
- data/spec/app/app/controllers/application_controller.rb +0 -2
- data/spec/app/app/controllers/css_controller.rb +0 -6
- data/spec/app/config/application.rb +0 -14
- data/spec/app/config/autoprefixer.yml +0 -2
- data/spec/app/config/boot.rb +0 -2
- data/spec/app/config/environment.rb +0 -3
- data/spec/app/config/environments/test.rb +0 -9
- data/spec/app/config/initializers/compress.rb +0 -1
- data/spec/app/config/initializers/secret_token.rb +0 -1
- data/spec/app/config/routes.rb +0 -3
- data/spec/app/config.ru +0 -2
- data/spec/autoprefixer_spec.rb +0 -112
- data/spec/compass/config.rb +0 -34
- data/spec/compass/sass/screen.scss +0 -3
- data/spec/compass_spec.rb +0 -21
- data/spec/processor_spec.rb +0 -14
- data/spec/rails_spec.rb +0 -50
- data/spec/railtie_spec.rb +0 -29
- data/spec/spec_helper.rb +0 -16
- data/sprockets4.gemfile +0 -9
metadata
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoprefixer-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 10.4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Sitnik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rspec-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,7 +67,35 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.85.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.85.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-packaging
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.1.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.1.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: standard
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
101
|
- - ">="
|
@@ -89,15 +117,9 @@ extra_rdoc_files:
|
|
89
117
|
- LICENSE
|
90
118
|
- CHANGELOG.md
|
91
119
|
files:
|
92
|
-
- ".gitignore"
|
93
|
-
- ".rspec"
|
94
|
-
- ".travis.yml"
|
95
120
|
- CHANGELOG.md
|
96
|
-
- Gemfile
|
97
121
|
- LICENSE
|
98
122
|
- README.md
|
99
|
-
- Rakefile
|
100
|
-
- autoprefixer-rails.gemspec
|
101
123
|
- lib/autoprefixer-rails.rb
|
102
124
|
- lib/autoprefixer-rails/processor.rb
|
103
125
|
- lib/autoprefixer-rails/railtie.rb
|
@@ -105,40 +127,14 @@ files:
|
|
105
127
|
- lib/autoprefixer-rails/sprockets.rb
|
106
128
|
- lib/autoprefixer-rails/version.rb
|
107
129
|
- lib/rake/autoprefixer_tasks.rb
|
108
|
-
- spec/app/.browserslistrc
|
109
|
-
- spec/app/.gitignore
|
110
|
-
- spec/app/Rakefile
|
111
|
-
- spec/app/app/assets/config/manifest.js
|
112
|
-
- spec/app/app/assets/stylesheets/evaluate.css.erb
|
113
|
-
- spec/app/app/assets/stylesheets/loaded.sass
|
114
|
-
- spec/app/app/assets/stylesheets/sass.sass
|
115
|
-
- spec/app/app/assets/stylesheets/test.css
|
116
|
-
- spec/app/app/assets/stylesheets/wrong.css
|
117
|
-
- spec/app/app/controllers/application_controller.rb
|
118
|
-
- spec/app/app/controllers/css_controller.rb
|
119
|
-
- spec/app/config.ru
|
120
|
-
- spec/app/config/application.rb
|
121
|
-
- spec/app/config/autoprefixer.yml
|
122
|
-
- spec/app/config/boot.rb
|
123
|
-
- spec/app/config/environment.rb
|
124
|
-
- spec/app/config/environments/test.rb
|
125
|
-
- spec/app/config/initializers/compress.rb
|
126
|
-
- spec/app/config/initializers/secret_token.rb
|
127
|
-
- spec/app/config/routes.rb
|
128
|
-
- spec/autoprefixer_spec.rb
|
129
|
-
- spec/compass/config.rb
|
130
|
-
- spec/compass/sass/screen.scss
|
131
|
-
- spec/compass_spec.rb
|
132
|
-
- spec/processor_spec.rb
|
133
|
-
- spec/rails_spec.rb
|
134
|
-
- spec/railtie_spec.rb
|
135
|
-
- spec/spec_helper.rb
|
136
|
-
- sprockets4.gemfile
|
137
130
|
- vendor/autoprefixer.js
|
138
131
|
homepage: https://github.com/ai/autoprefixer-rails
|
139
132
|
licenses:
|
140
133
|
- MIT
|
141
|
-
metadata:
|
134
|
+
metadata:
|
135
|
+
changelog_uri: https://github.com/ai/autoprefixer-rails/blob/master/CHANGELOG.md
|
136
|
+
source_code_uri: https://github.com/ai/autoprefixer-rails
|
137
|
+
bug_tracker_uri: https://github.com/ai/autoprefixer-rails/issues
|
142
138
|
post_install_message:
|
143
139
|
rdoc_options: []
|
144
140
|
require_paths:
|
@@ -147,15 +143,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
143
|
requirements:
|
148
144
|
- - ">="
|
149
145
|
- !ruby/object:Gem::Version
|
150
|
-
version: '2.
|
146
|
+
version: '2.4'
|
151
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
148
|
requirements:
|
153
149
|
- - ">="
|
154
150
|
- !ruby/object:Gem::Version
|
155
151
|
version: '0'
|
156
152
|
requirements: []
|
157
|
-
|
158
|
-
rubygems_version: 2.7.6
|
153
|
+
rubygems_version: 3.0.3
|
159
154
|
signing_key:
|
160
155
|
specification_version: 4
|
161
156
|
summary: Parse CSS and add vendor prefixes to CSS rules using values from the Can
|
data/.gitignore
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--format documentation --colour
|
data/.travis.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- "2.6"
|
4
|
-
- "2.5"
|
5
|
-
- "2.4"
|
6
|
-
- "2.3"
|
7
|
-
git:
|
8
|
-
depth: 5
|
9
|
-
cache: bundler
|
10
|
-
before_install:
|
11
|
-
- gem update --system
|
12
|
-
- nvm install node
|
13
|
-
env:
|
14
|
-
- EXECJS_RUNTIME=Node
|
15
|
-
- EXECJS_RUNTIME=MiniRacer
|
16
|
-
matrix:
|
17
|
-
exclude:
|
18
|
-
- rvm: "2.3"
|
19
|
-
env: "EXECJS_RUNTIME=Node"
|
20
|
-
|
21
|
-
- rvm: "2.4"
|
22
|
-
env: "EXECJS_RUNTIME=Node"
|
23
|
-
|
24
|
-
- rvm: "2.5"
|
25
|
-
env: "EXECJS_RUNTIME=Node"
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
require 'rubygems'
|
3
|
-
|
4
|
-
require 'bundler/setup'
|
5
|
-
Bundler::GemHelper.install_tasks
|
6
|
-
|
7
|
-
require 'rspec/core/rake_task'
|
8
|
-
RSpec::Core::RakeTask.new
|
9
|
-
task :default => :spec
|
10
|
-
|
11
|
-
task :clobber_package do
|
12
|
-
rm_r 'pkg' rescue nil
|
13
|
-
end
|
14
|
-
|
15
|
-
desc 'Delete all generated files'
|
16
|
-
task :clobber => [:clobber_package]
|
17
|
-
|
18
|
-
desc 'Test all Gemfiles from spec/*.gemfile'
|
19
|
-
task :test_all do
|
20
|
-
require 'pty'
|
21
|
-
require 'shellwords'
|
22
|
-
cmd = 'bundle update && bundle exec rake --trace'
|
23
|
-
statuses = Dir.glob('./sprockets*.gemfile').map do |gemfile|
|
24
|
-
Bundler.with_clean_env do
|
25
|
-
env = { 'BUNDLE_GEMFILE' => gemfile }
|
26
|
-
$stderr.puts "Testing #{ File.basename(gemfile) }:"
|
27
|
-
$stderr.puts " export BUNDLE_GEMFILE=#{ gemfile }"
|
28
|
-
$stderr.puts " #{ cmd }"
|
29
|
-
PTY.spawn(env, cmd) do |r, _w, pid|
|
30
|
-
begin
|
31
|
-
r.each_line { |l| puts l }
|
32
|
-
rescue Errno::EIO
|
33
|
-
# Errno:EIO error means that the process has finished giving output.
|
34
|
-
ensure
|
35
|
-
::Process.wait pid
|
36
|
-
end
|
37
|
-
end
|
38
|
-
[$? && $?.exitstatus == 0, gemfile]
|
39
|
-
end
|
40
|
-
end
|
41
|
-
failed = statuses.reject(&:first).map(&:last)
|
42
|
-
if failed.empty?
|
43
|
-
$stderr.puts "✓ Tests pass with all #{ statuses.size } gemfiles"
|
44
|
-
else
|
45
|
-
$stderr.puts "❌ FAILING #{ failed * "\n" }"
|
46
|
-
exit 1
|
47
|
-
end
|
48
|
-
end
|
data/autoprefixer-rails.gemspec
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require File.expand_path('../lib/autoprefixer-rails/version', __FILE__)
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.platform = Gem::Platform::RUBY
|
5
|
-
s.name = 'autoprefixer-rails'
|
6
|
-
s.version = AutoprefixerRails::VERSION.dup
|
7
|
-
s.date = Time.now.strftime('%Y-%m-%d')
|
8
|
-
s.summary = 'Parse CSS and add vendor prefixes to CSS rules using ' +
|
9
|
-
'values from the Can I Use website.'
|
10
|
-
|
11
|
-
s.files = `git ls-files`.split("\n")
|
12
|
-
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
13
|
-
s.extra_rdoc_files = ['README.md', 'LICENSE', 'CHANGELOG.md']
|
14
|
-
s.require_path = 'lib'
|
15
|
-
s.required_ruby_version = '>= 2.0'
|
16
|
-
|
17
|
-
s.author = 'Andrey Sitnik'
|
18
|
-
s.email = 'andrey@sitnik.ru'
|
19
|
-
s.homepage = 'https://github.com/ai/autoprefixer-rails'
|
20
|
-
s.license = 'MIT'
|
21
|
-
|
22
|
-
s.add_dependency 'execjs', '>= 0'
|
23
|
-
|
24
|
-
s.add_development_dependency 'rake'
|
25
|
-
s.add_development_dependency 'rails'
|
26
|
-
s.add_development_dependency 'compass'
|
27
|
-
s.add_development_dependency 'rspec-rails'
|
28
|
-
end
|
data/spec/app/.browserslistrc
DELETED
data/spec/app/.gitignore
DELETED
data/spec/app/Rakefile
DELETED
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= evaluate 'test.css' %>
|
@@ -1 +0,0 @@
|
|
1
|
-
@import "loaded"
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require 'action_controller/railtie'
|
4
|
-
require 'sprockets/railtie'
|
5
|
-
|
6
|
-
if defined?(Bundler)
|
7
|
-
Bundler.require(*Rails.groups(assets: %w(development test)))
|
8
|
-
end
|
9
|
-
|
10
|
-
module App
|
11
|
-
class Application < Rails::Application
|
12
|
-
config.assets.enabled = true
|
13
|
-
end
|
14
|
-
end
|
data/spec/app/config/boot.rb
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
App::Application.configure do
|
2
|
-
config.cache_classes = true
|
3
|
-
config.eager_load = false
|
4
|
-
config.consider_all_requests_local = true
|
5
|
-
config.action_controller.perform_caching = false
|
6
|
-
config.action_dispatch.show_exceptions = false
|
7
|
-
config.action_controller.allow_forgery_protection = false
|
8
|
-
config.active_support.deprecation = :stderr
|
9
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
Rails.application.config.assets.css_compressor = nil
|
@@ -1 +0,0 @@
|
|
1
|
-
App::Application.config.secret_key_base = 'test'
|
data/spec/app/config/routes.rb
DELETED
data/spec/app/config.ru
DELETED
data/spec/autoprefixer_spec.rb
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
require_relative 'spec_helper'
|
2
|
-
|
3
|
-
describe AutoprefixerRails do
|
4
|
-
before :all do
|
5
|
-
@dir = Pathname(__FILE__).dirname
|
6
|
-
@css = @dir.join('app/app/assets/stylesheets/test.css').read
|
7
|
-
end
|
8
|
-
|
9
|
-
it "process CSS" do
|
10
|
-
expect(AutoprefixerRails.process(@css)).to be_a(AutoprefixerRails::Result)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "process CSS for selected browsers" do
|
14
|
-
css = "a {\n tab-size: 2\n}"
|
15
|
-
result = AutoprefixerRails.process(css, browsers: ['opera 12'])
|
16
|
-
expect(result.css).to eq "a {\n" +
|
17
|
-
" -o-tab-size: 2;\n" +
|
18
|
-
" tab-size: 2\n" +
|
19
|
-
"}"
|
20
|
-
end
|
21
|
-
|
22
|
-
it "process @supports" do
|
23
|
-
css = "@supports (display: flex) { }"
|
24
|
-
result = AutoprefixerRails.process(css, browsers: ['chrome 28'])
|
25
|
-
expect(result.css).to eq(
|
26
|
-
'@supports ((display: -webkit-flex) or (display: flex)) { }')
|
27
|
-
end
|
28
|
-
|
29
|
-
it "generates source map" do
|
30
|
-
result = AutoprefixerRails.process(@css, map: true)
|
31
|
-
expect(result.css).to include('/*# sourceMappingURL=data:')
|
32
|
-
end
|
33
|
-
|
34
|
-
it "generates separated source map" do
|
35
|
-
result = AutoprefixerRails.process(@css, map: { inline: false })
|
36
|
-
expect(result.map).to be_a(String)
|
37
|
-
end
|
38
|
-
|
39
|
-
it "uses file name in syntax errors", not_jruby: true do
|
40
|
-
expect {
|
41
|
-
AutoprefixerRails.process('a {', from: 'a.css')
|
42
|
-
}.to raise_error(/a.css:/)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "includes sourcesContent by default" do
|
46
|
-
map = AutoprefixerRails.process('a{}', map: { inline: false }).map
|
47
|
-
expect(map).to include('sourcesContent')
|
48
|
-
end
|
49
|
-
|
50
|
-
it "maps options from Ruby style" do
|
51
|
-
map = AutoprefixerRails.process('a{}', map: {
|
52
|
-
sources_content: false,
|
53
|
-
inline: false
|
54
|
-
}).map
|
55
|
-
|
56
|
-
expect(map).not_to include('sourcesContent')
|
57
|
-
end
|
58
|
-
|
59
|
-
it "does not remove old prefixes on request" do
|
60
|
-
css = 'a { -moz-border-radius: 5px; border-radius: 5px }'
|
61
|
-
result = AutoprefixerRails.process(css, remove: false)
|
62
|
-
expect(result.css).to eq(css)
|
63
|
-
end
|
64
|
-
|
65
|
-
it "shows debug" do
|
66
|
-
info = AutoprefixerRails.processor(browsers: ['chrome 25']).info
|
67
|
-
expect(info).to match(/Browsers:\n Chrome: 25\n\n/)
|
68
|
-
expect(info).to match(/ transition: webkit/)
|
69
|
-
end
|
70
|
-
|
71
|
-
it "returns warnings" do
|
72
|
-
css = 'a{background:linear-gradient(top,white,black)}'
|
73
|
-
result = AutoprefixerRails.process(css)
|
74
|
-
expect(result.warnings).to eq(['<css input>:1:3: Gradient has outdated ' +
|
75
|
-
'direction syntax. New syntax is like `to left` instead of `right`.'])
|
76
|
-
end
|
77
|
-
|
78
|
-
it "shows correct error on country statistics" do
|
79
|
-
expect {
|
80
|
-
AutoprefixerRails.process('', browsers: '> 1% in US')
|
81
|
-
}.to raise_error(/Use Autoprefixer with webpack/)
|
82
|
-
end
|
83
|
-
|
84
|
-
context 'Sprockets' do
|
85
|
-
before :each do
|
86
|
-
@assets = Sprockets::Environment.new
|
87
|
-
@assets.append_path(@dir.join('app/app/assets/stylesheets'))
|
88
|
-
AutoprefixerRails.install(@assets, browsers: ['chrome 25'])
|
89
|
-
end
|
90
|
-
|
91
|
-
it "integrates with Sprockets" do
|
92
|
-
css = @assets['test.css'].to_s
|
93
|
-
expect(css).to eq "a {\n" +
|
94
|
-
" -webkit-mask: none;\n" +
|
95
|
-
" mask: none\n" +
|
96
|
-
"}\n"
|
97
|
-
end
|
98
|
-
|
99
|
-
it "shows file name from Sprockets", not_jruby: true do
|
100
|
-
expect { @assets['wrong.css'] }.to raise_error(/wrong/)
|
101
|
-
end
|
102
|
-
|
103
|
-
it "supports disabling", not_jruby: true do
|
104
|
-
AutoprefixerRails.uninstall(@assets)
|
105
|
-
css = @assets['test.css'].to_s
|
106
|
-
expect(css).to eq "a {\n" +
|
107
|
-
" mask: none\n" +
|
108
|
-
"}\n"
|
109
|
-
end
|
110
|
-
|
111
|
-
end
|
112
|
-
end
|
data/spec/compass/config.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
http_path = "/"
|
2
|
-
css_dir = "stylesheets"
|
3
|
-
sass_dir = "sass"
|
4
|
-
images_dir = "images"
|
5
|
-
javascripts_dir = "javascripts"
|
6
|
-
|
7
|
-
sourcemap = true
|
8
|
-
output_style = :compressed
|
9
|
-
sass_options = { cache: false }
|
10
|
-
line_comments = false
|
11
|
-
|
12
|
-
require 'rubygems'
|
13
|
-
require 'bundler'
|
14
|
-
Bundler.require
|
15
|
-
require '../../lib/autoprefixer-rails'
|
16
|
-
|
17
|
-
on_stylesheet_saved do |file|
|
18
|
-
css = File.read(file)
|
19
|
-
map = file + '.map'
|
20
|
-
|
21
|
-
if File.exists? map
|
22
|
-
result = AutoprefixerRails.process(css,
|
23
|
-
browsers: ['chrome 25'],
|
24
|
-
from: file,
|
25
|
-
to: file,
|
26
|
-
map: { prev: File.read(map), inline: false })
|
27
|
-
File.open(file, 'w') { |io| io << result.css }
|
28
|
-
File.open(map, 'w') { |io| io << result.map }
|
29
|
-
else
|
30
|
-
File.open(file, 'w') do |io|
|
31
|
-
io << AutoprefixerRails.process(css, browsers: ['chrome 25'])
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
data/spec/compass_spec.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require_relative 'spec_helper'
|
2
|
-
|
3
|
-
COMPASS_DIR = Pathname(__FILE__).dirname.join('compass')
|
4
|
-
STYLESHEETS_DIR = COMPASS_DIR.join('stylesheets')
|
5
|
-
|
6
|
-
describe 'Compass integration' do
|
7
|
-
after do
|
8
|
-
STYLESHEETS_DIR.rmtree if STYLESHEETS_DIR.exist?
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'works from config.rb' do
|
12
|
-
`cd #{ COMPASS_DIR }; bundle exec compass compile`
|
13
|
-
expect(STYLESHEETS_DIR.join('screen.css').read)
|
14
|
-
.to eq("a{display:-webkit-flex;display:flex}\n\n" +
|
15
|
-
"/*# sourceMappingURL=screen.css.map */")
|
16
|
-
expect(STYLESHEETS_DIR.join('screen.css.map').read)
|
17
|
-
.to eq('{"version":3,"sources":["../sass/screen.scss"],"names":[],' +
|
18
|
-
'"mappings":"AAAA,EACI,oBAAS,CAAT,YAAa","file":"screen.css"}')
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
data/spec/processor_spec.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require_relative 'spec_helper'
|
2
|
-
|
3
|
-
describe AutoprefixerRails::Processor do
|
4
|
-
|
5
|
-
it 'parses config' do
|
6
|
-
config = "# Comment\n ie 11\n \nie 8 # sorry\n[test ]\nios 8"
|
7
|
-
processor = AutoprefixerRails::Processor.new
|
8
|
-
expect(processor.parse_config(config)).to eql({
|
9
|
-
'defaults' => ['ie 11', 'ie 8'],
|
10
|
-
'test' => ['ios 8']
|
11
|
-
})
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
data/spec/rails_spec.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require_relative 'spec_helper'
|
2
|
-
|
3
|
-
describe CssController, type: :controller do
|
4
|
-
before :all do
|
5
|
-
cache = Rails.root.join('tmp/cache')
|
6
|
-
cache.rmtree if cache.exist?
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_file(file)
|
10
|
-
if Rails.version.split('.').first.to_i >= 5
|
11
|
-
get :test, params: { file: file }
|
12
|
-
else
|
13
|
-
get :test, file: file
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
it "integrates with Rails and Sass" do
|
18
|
-
test_file 'sass'
|
19
|
-
expect(response).to be_successful
|
20
|
-
clear_css = response.body.gsub("\n", " ").squeeze(" ").strip
|
21
|
-
expect(clear_css).to eq "a { -webkit-mask: none; mask: none }"
|
22
|
-
end
|
23
|
-
|
24
|
-
if Sprockets::Context.instance_methods.include?(:evaluate)
|
25
|
-
it 'supports evaluate' do
|
26
|
-
test_file 'evaluate'
|
27
|
-
expect(response).to be_successful
|
28
|
-
clear_css = response.body.gsub("\n", ' ').squeeze(' ').strip
|
29
|
-
expect(clear_css).to eq 'a { -webkit-mask: none; mask: none }'
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
if sprockets_4?
|
34
|
-
it "works with sprockets 4 source maps" do
|
35
|
-
get :test, params: { exact_file: 'sass.css.map' }
|
36
|
-
expect(response).to be_successful
|
37
|
-
|
38
|
-
source_map = JSON.parse(response.body)['sections'].first['map']
|
39
|
-
expect(source_map['sources'].first).to match(/loaded.*.sass/)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe 'Rake task' do
|
45
|
-
it "shows debug" do
|
46
|
-
info = `cd spec/app; bundle exec rake autoprefixer:info`
|
47
|
-
expect(info).to match(/Browsers:\n Chrome: 25\n\n/)
|
48
|
-
expect(info).to match(/ transition: webkit/)
|
49
|
-
end
|
50
|
-
end
|
data/spec/railtie_spec.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require_relative 'spec_helper'
|
2
|
-
|
3
|
-
describe AutoprefixedRails::Railtie do
|
4
|
-
before do
|
5
|
-
@railtie = AutoprefixedRails::Railtie.instance
|
6
|
-
end
|
7
|
-
|
8
|
-
context 'with config/autoprefixer.yml' do
|
9
|
-
it 'works' do
|
10
|
-
expect(@railtie.config).to eq(cascade: false, supports: false, env: 'test')
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'with empty config/autoprefixer.yml' do
|
15
|
-
before do
|
16
|
-
file_path = File.join(Rails.application.root, 'config/autoprefixer.yml')
|
17
|
-
allow(File).to receive(:exists?).with(file_path) { true }
|
18
|
-
allow(::YAML).to receive(:load_file).with(file_path) { false } # empty yaml
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'skips empty YAML' do
|
22
|
-
expect { @railtie.config }.not_to raise_error
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'works' do
|
26
|
-
expect(@railtie.config).to eq(env: 'test')
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|