autoprefixer-rails 9.4.8 → 9.8.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 391e0d51af9f5b7329180f64924e671c0988ac75a183029fa8d82f31c465f386
4
- data.tar.gz: 4029de465480eb8039a271f97210afed60f564e907d126cc5a79065d177e9da0
3
+ metadata.gz: 4773892966766ddd6848426c50d8e97b07d19d5110848cb8051d41bc2308f6eb
4
+ data.tar.gz: 7bd94adaae2a41a9e98c1eea269b03a339c546a337dddf2c79009eec005ebe5b
5
5
  SHA512:
6
- metadata.gz: d0ff0ef5d501b899948028291cff1a8a99fd97205cec2ddf77b705cdce356ff209fc2842a4b5ffdbdb9c5427e0230463264cc3e07ebe90225fa32e536481c400
7
- data.tar.gz: da5d66e4dc292111ae79dda85f52d647110fd7c17a839b58d801fda992761fa806787268ea69a50edd20b2d9f79daf020f517601838b16d0bcf14c0e06db1943
6
+ metadata.gz: 7109528a179d5171e996585b680fffd2fb63a428eb50f6b45e3d462be4885dbb68c884cf26ae70726bfe6b492803ca5674918557ba0856f09b6f8a317cddfff4
7
+ data.tar.gz: 8fa8e32784358ab308addd8952fd6b022d1e7cca5a2e3798a93ab5c3673f37a76f18d92592312cc3acf8e7536e72cb96a99986d8e5625ee5c5d6c61d0cbc08ae
data/CHANGELOG.md CHANGED
@@ -1,5 +1,114 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.8.6.5
4
+ * Fix `9.8.6.4` regression.
5
+
6
+ ## 9.8.6.4
7
+ * Remove deprecation warnings.
8
+
9
+ ## 9.8.6.3
10
+ * Fix deprecation warning for non-Rails environment.
11
+
12
+ ## 9.8.6.2
13
+ * Print deprecation warning only once.
14
+
15
+ ## 9.8.6.1
16
+ * Improve deprecated warnings.
17
+
18
+ ## 9.8.6
19
+ * Fixed `env` option.
20
+ * Added deprecation warning.
21
+
22
+ ## 9.8.5
23
+ * Improved Grid Layout warnings (by Daniel Tonon).
24
+
25
+ ## 9.8.4
26
+ * Reduce JS bundle size.
27
+
28
+ ## 9.8.3
29
+ * Update Can I Use data.
30
+
31
+ ## 9.8.2
32
+ * Update Can I Use data.
33
+
34
+ ## 9.8.1
35
+ * Replace `chalk` to `kleur` (by Luke Edwards).
36
+
37
+ ## 9.8 “Vigilo Confido”
38
+ * Add `:placeholder-shown` support (by Tanguy Krotoff).
39
+
40
+ ## 9.7.6
41
+ * Revert `-webkit-stretch` fix.
42
+
43
+ ## 9.7.5
44
+ * Fix `-webkit-stretch` support.
45
+ * Reduce gem file size.
46
+
47
+ ## 9.7.4
48
+ * Update Can I Use data.
49
+
50
+ ## 9.7.3
51
+ * Update Can I Use data.
52
+
53
+ ## 9.7.2
54
+ * Add `-ms-user-select: element` support.
55
+
56
+ ## 9.7.1
57
+ * Avoid unnecessary transitions in prefixed selectors (by Andrey Alexandrov).
58
+ * Fix `fit-content` for Firefox.
59
+
60
+ ## 9.7 “Ad Victoriam”
61
+ * Add `AUTOPREFIXER_GRID` env variable to enable Grid Layout polyfill for IE.
62
+ * Fix `Cannot read property 'grid' of undefined` error.
63
+
64
+ ## 9.6.5
65
+ * Fix selector prefixing (by Andrey Alexandrov).
66
+
67
+ ## 9.6.4
68
+ * Now the real fix for `'startsWith' of undefined` error.
69
+
70
+ ## 9.6.3
71
+ * Fix `Cannot read property 'startsWith' of undefined` error.
72
+
73
+ ## 9.6.2
74
+ * Fix false `Replace fill to stretch` warning.
75
+
76
+ ## 9.6.1.1
77
+ * Update Can I Use data.
78
+
79
+ ## 9.6.1
80
+ * Fix `-webkit-line-clamp` truncating multi-line text support.
81
+
82
+ ## 9.6 “Nunc id vides, nunc ne vides”
83
+ * Add warning-less `overrideBrowserslist` option.
84
+ * Add `text-orientation` support.
85
+ * Add `min-resolution: 2x` alias support.
86
+
87
+ ## 9.5.1.1
88
+ * Fix `register_postprocessor' for nil:NilClass` error.
89
+ * Update Can I Use data.
90
+
91
+ ## 9.5.1
92
+ * Fix `backdrop-filter` for Edge (by Oleh Aloshkin).
93
+ * Fix `min-resolution` media query support in Firefox < 16.
94
+
95
+ ## 9.5 “Draco dormiens nunquam titillandus”
96
+ * Add `mask-composite` support (by Semen Levenson).
97
+
98
+ ## 9.4.10.2
99
+ * Fix Ruby < 2.4 support (by Jack Ford).
100
+ * Update Can I Use data.
101
+
102
+ ## 9.4.10.1
103
+ * Fix non-Rails environments support (by Junya Ogura).
104
+ * Update Can I Use data.
105
+
106
+ ## 9.4.10
107
+ * Add warning for named Grid rows.
108
+
109
+ ## 9.4.9
110
+ * Fix `grid-template` and `@media` case (by Bogdan Dolin).
111
+
3
112
  ## 9.4.8
4
113
  * Fix `calc()` support in Grid gap.
5
114
 
data/README.md CHANGED
@@ -5,17 +5,18 @@
5
5
  title="Autoprefixer logo by Anton Lovchikov">
6
6
 
7
7
  [Autoprefixer] is a tool to parse CSS and add vendor prefixes to CSS rules
8
- using values from the [Can I Use] database. This gem provides Ruby and Ruby on Rails
9
- integration with this JavaScript tool.
8
+ using values from the [Can I Use] database. This gem provides Ruby
9
+ and Ruby on Rails integration with this JavaScript tool.
10
10
 
11
11
  <a href="https://evilmartians.com/?utm_source=autoprefixer-rails">
12
12
  <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54">
13
13
  </a>
14
14
 
15
- [Autoprefixer]: https://github.com/postcss/autoprefixer
16
- [Can I Use]: http://caniuse.com/
17
- [ci-img]: https://travis-ci.org/ai/autoprefixer-rails.svg
18
- [ci]: https://travis-ci.org/ai/autoprefixer-rails
15
+ [Autoprefixer]: https://github.com/postcss/autoprefixer
16
+ [Can I Use]: http://caniuse.com/
17
+ [PostCSS]: https://postcss.org/
18
+ [ci-img]: https://travis-ci.org/ai/autoprefixer-rails.svg
19
+ [ci]: https://travis-ci.org/ai/autoprefixer-rails
19
20
 
20
21
  ## Differences
21
22
 
@@ -87,26 +88,15 @@ support to add vendor prefixes automatically using the Asset Pipeline:
87
88
  }
88
89
  ```
89
90
 
90
- If you need to specify browsers for your Rails project, you can save them to
91
+ If you need to specify browsers for your Rails project, you can save them
92
+ to `.browserslistrc` and place it under `app/assets/stylesheets/`
93
+ or any of its ancestor directories
91
94
 
92
- * `browserslist` and place it under `app/assets/stylesheets/`
93
- or any of its ancestor directories
94
-
95
- ```
96
- > 1%
97
- last 2 versions
98
- IE > 8 # comment
99
- ```
100
-
101
- * Or `config/autoprefixer.yml`
102
-
103
- ```yaml
104
- flexbox: no-2009
105
- browsers:
106
- - "> 1%"
107
- - "last 2 versions"
108
- - "IE > 8"
109
- ```
95
+ ```
96
+ > 1%
97
+ last 2 versions
98
+ IE > 8 # comment
99
+ ```
110
100
 
111
101
  See [Browserslist docs] for config format. But `> 5% in US` query is not
112
102
  supported in Rails, because of ExecJS limitations. You should migrate to webpack
@@ -154,12 +144,6 @@ require "autoprefixer-rails"
154
144
  prefixed = AutoprefixerRails.process(css, from: 'main.css').css
155
145
  ```
156
146
 
157
- You can specify browsers with the `browsers` option:
158
-
159
- ```ruby
160
- AutoprefixerRails.process(css, from: 'a.css', browsers: ['> 1%', 'ie 10']).css
161
- ```
162
-
163
147
  ### Compass
164
148
 
165
149
  You should consider using Gulp instead of Compass binary,
@@ -244,3 +228,11 @@ to JS style, so you can use `map: { sources_content: false }`
244
228
  instead of camelcase `sourcesContent`.
245
229
 
246
230
  [PostCSS docs]: https://github.com/postcss/postcss#source-map-1
231
+
232
+
233
+ ## Security Contact
234
+
235
+ To report a security vulnerability, please use the [Tidelift security contact].
236
+ Tidelift will coordinate the fix and disclosure.
237
+
238
+ [Tidelift security contact]: https://tidelift.com/security
@@ -1,15 +1,29 @@
1
- require 'pathname'
2
- require 'execjs'
3
- require 'json'
1
+ # frozen_string_literal: true
4
2
 
5
- IS_SECTION = /^\s*\[(.+)\]\s*$/
3
+ require "pathname"
4
+ require "execjs"
5
+ require "json"
6
+
7
+ IS_SECTION = /^\s*\[(.+)\]\s*$/.freeze
6
8
 
7
9
  module AutoprefixerRails
10
+ def self.show_deprecation_message!
11
+ return unless defined?(ActiveSupport::Deprecation)
12
+
13
+ return if defined?(@deprecation_shown)
14
+
15
+ ActiveSupport::Deprecation.warn(
16
+ "autoprefixer-rails was deprected. Migration guide:\n" \
17
+ "https://github.com/ai/autoprefixer-rails/wiki/Deprecated"
18
+ )
19
+
20
+ @deprecation_shown = true
21
+ end
22
+
8
23
  # Ruby to JS wrapper for Autoprefixer processor instance
9
24
  class Processor
10
-
11
- def initialize(params = { })
12
- @params = params || { }
25
+ def initialize(params = {})
26
+ @params = params || {}
13
27
  end
14
28
 
15
29
  # Process `css` and return result.
@@ -18,85 +32,81 @@ module AutoprefixerRails
18
32
  # * `from` with input CSS file name. Will be used in error messages.
19
33
  # * `to` with output CSS file name.
20
34
  # * `map` with true to generate new source map or with previous map.
21
- def process(css, opts = { })
35
+ def process(css, opts = {})
36
+ AutoprefixerRails.show_deprecation_message!
37
+
22
38
  opts = convert_options(opts)
23
39
 
24
40
  apply_wrapper =
25
- "(function(opts, pluginOpts) {" +
26
- "return eval(process.apply(this, opts, pluginOpts));" +
41
+ "(function(opts, pluginOpts) {" \
42
+ "return eval(process.apply(this, opts, pluginOpts));" \
27
43
  "})"
28
44
 
29
- pluginOpts = params_with_browsers(opts[:from]).merge(opts)
30
- processOpts = {
31
- from: pluginOpts.delete(:from),
32
- to: pluginOpts.delete(:to),
33
- map: pluginOpts.delete(:map)
45
+ plugin_opts = params_with_browsers(opts[:from]).merge(opts)
46
+ process_opts = {
47
+ from: plugin_opts.delete(:from),
48
+ to: plugin_opts.delete(:to),
49
+ map: plugin_opts.delete(:map)
34
50
  }
35
51
 
36
52
  begin
37
- result = runtime.call(apply_wrapper, [css, processOpts, pluginOpts])
53
+ result = runtime.call(apply_wrapper, [css, process_opts, plugin_opts])
38
54
  rescue ExecJS::ProgramError => e
39
- contry_error = 'BrowserslistError: ' +
40
- 'Country statistics is not supported ' +
41
- 'in client-side build of Browserslist'
55
+ contry_error = "BrowserslistError: " \
56
+ "Country statistics is not supported " \
57
+ "in client-side build of Browserslist"
42
58
  if e.message == contry_error
43
- raise 'Country statistics is not supported in AutoprefixerRails. ' +
44
- 'Use Autoprefixer with webpack or other Node.js builder.'
59
+ raise "Country statistics is not supported in AutoprefixerRails. " \
60
+ "Use Autoprefixer with webpack or other Node.js builder."
45
61
  else
46
62
  raise e
47
63
  end
48
64
  end
49
65
 
50
- Result.new(result['css'], result['map'], result['warnings'])
66
+ Result.new(result["css"], result["map"], result["warnings"])
51
67
  end
52
68
 
53
69
  # Return, which browsers and prefixes will be used
54
70
  def info
55
- runtime.eval("autoprefixer(#{ js_params }).info()")
71
+ runtime.eval("autoprefixer(#{js_params}).info()")
56
72
  end
57
73
 
58
74
  # Parse Browserslist config
59
75
  def parse_config(config)
60
- sections = { 'defaults' => [] }
61
- current = 'defaults'
62
- config.gsub(/#[^\n]*/, '')
76
+ sections = { "defaults" => [] }
77
+ current = "defaults"
78
+ config.gsub(/#[^\n]*/, "")
63
79
  .split(/\n/)
64
80
  .map(&:strip)
65
81
  .reject(&:empty?)
66
82
  .each do |line|
67
- if line =~ IS_SECTION
68
- current = line.match(IS_SECTION)[1].strip
69
- sections[current] ||= []
70
- else
71
- sections[current] << line
72
- end
73
- end
83
+ if IS_SECTION =~ line
84
+ current = line.match(IS_SECTION)[1].strip
85
+ sections[current] ||= []
86
+ else
87
+ sections[current] << line
88
+ end
89
+ end
74
90
  sections
75
91
  end
76
92
 
77
93
  private
78
94
 
79
95
  def params_with_browsers(from = nil)
80
- unless from
81
- if defined? Rails and Rails.respond_to?(:root) and Rails.root
82
- from = Rails.root.join('app/assets/stylesheets').to_s
83
- else
84
- from = '.'
85
- end
86
- end
96
+ from ||= if defined?(Rails) && Rails.respond_to?(:root) && Rails.root
97
+ Rails.root.join("app/assets/stylesheets").to_s
98
+ else
99
+ "."
100
+ end
87
101
 
88
102
  params = @params
89
- if not params.has_key?(:browsers) and from
103
+ if !params.key?(:browsers) && !params.key?(:overrideBrowserslist) && from
90
104
  file = find_config(from)
91
105
  if file
92
- env = params[:env].to_s || 'development'
106
+ env = params[:env].to_s || "development"
93
107
  config = parse_config(file)
94
108
  params = params.dup
95
- if config[env]
96
- params[:browsers] = config[env]
97
- else
98
- params[:browsers] = config['defaults']
99
- end
109
+ params[:overrideBrowserslist] = (config[env] || config["defaults"])
100
110
  end
101
111
  end
102
112
 
@@ -105,18 +115,18 @@ module AutoprefixerRails
105
115
 
106
116
  # Convert params to JS string and add browsers from Browserslist config
107
117
  def js_params
108
- '{ ' +
109
- params_with_browsers.map { |k, v| "#{k}: #{v.inspect}"}.join(', ') +
110
- ' }'
118
+ "{ " +
119
+ params_with_browsers.map { |k, v| "#{k}: #{v.inspect}" }.join(", ") +
120
+ " }"
111
121
  end
112
122
 
113
123
  # Convert ruby_options to jsOptions
114
124
  def convert_options(opts)
115
- converted = { }
125
+ converted = {}
116
126
 
117
127
  opts.each_pair do |name, value|
118
- if name =~ /_/
119
- name = name.to_s.gsub(/_\w/) { |i| i.gsub('_', '').upcase }.to_sym
128
+ if /_/ =~ name
129
+ name = name.to_s.gsub(/_\w/) { |i| i.delete("_").upcase }.to_sym
120
130
  end
121
131
  value = convert_options(value) if value.is_a? Hash
122
132
  converted[name] = value
@@ -130,11 +140,11 @@ module AutoprefixerRails
130
140
  path = Pathname(file).expand_path
131
141
 
132
142
  while path.parent != path
133
- config1 = path.join('browserslist')
134
- return config1.read if config1.exist? and not config1.directory?
143
+ config1 = path.join("browserslist")
144
+ return config1.read if config1.exist? && !config1.directory?
135
145
 
136
- config2 = path.join('.browserslistrc')
137
- return config2.read if config2.exist? and not config1.directory?
146
+ config2 = path.join(".browserslistrc")
147
+ return config2.read if config2.exist? && !config1.directory?
138
148
 
139
149
  path = path.parent
140
150
  end
@@ -145,23 +155,21 @@ module AutoprefixerRails
145
155
  # Lazy load for JS library
146
156
  def runtime
147
157
  @runtime ||= begin
148
- if ExecJS.eval('typeof Uint8Array') != 'function'
149
- if ExecJS.runtime.name.start_with?('therubyracer')
150
- raise "ExecJS::RubyRacerRuntime is not supported. " +
151
- "Please replace therubyracer with mini_racer " +
152
- "in your Gemfile or use Node.js as ExecJS runtime."
158
+ if ExecJS.eval("typeof Uint8Array") != "function"
159
+ if ExecJS.runtime.name.start_with?("therubyracer")
160
+ raise "ExecJS::RubyRacerRuntime is not supported. " \
161
+ "Please replace therubyracer with mini_racer " \
162
+ "in your Gemfile or use Node.js as ExecJS runtime."
153
163
  else
154
- raise "#{ExecJS.runtime.name} runtime does’t support ES6. " +
155
- "Please update or replace your current ExecJS runtime."
164
+ raise "#{ExecJS.runtime.name} runtime does’t support ES6. " \
165
+ "Please update or replace your current ExecJS runtime."
156
166
  end
157
167
  end
158
168
 
159
169
  if ExecJS.runtime == ExecJS::Runtimes::Node
160
- version = ExecJS.runtime.eval('process.version')
170
+ version = ExecJS.runtime.eval("process.version")
161
171
  first = version.match(/^v(\d+)/)[1].to_i
162
- if first < 6
163
- raise "Autoprefixer doesn’t support Node #{ version }. Update it."
164
- end
172
+ raise "Autoprefixer doesn’t support Node #{version}. Update it." if first < 6
165
173
  end
166
174
 
167
175
  ExecJS.compile(build_js)
@@ -170,7 +178,7 @@ module AutoprefixerRails
170
178
 
171
179
  # Cache autoprefixer.js content
172
180
  def read_js
173
- @@js ||= begin
181
+ @read_js ||= begin
174
182
  root = Pathname(File.dirname(__FILE__))
175
183
  path = root.join("../../vendor/autoprefixer.js")
176
184
  path.read
@@ -179,7 +187,7 @@ module AutoprefixerRails
179
187
 
180
188
  # Return processor JS with some extra methods
181
189
  def build_js
182
- 'var global = this;' + read_js + process_proxy
190
+ "var global = this;" + read_js + process_proxy
183
191
  end
184
192
 
185
193
  # Return JS code for process method proxy
@@ -1,22 +1,22 @@
1
- require 'yaml'
1
+ # frozen_string_literal: true
2
+
3
+ require "yaml"
2
4
 
3
5
  begin
4
6
  module AutoprefixedRails
5
- class Railtie < ::Rails::Railtie
7
+ class Railtie < ::Rails::Railtie # :nodoc:
6
8
  rake_tasks do |app|
7
- require 'rake/autoprefixer_tasks'
8
- Rake::AutoprefixerTasks.new( config ) if defined? app.assets
9
+ require "rake/autoprefixer_tasks"
10
+ Rake::AutoprefixerTasks.new(config) if defined? app.assets
9
11
  end
10
12
 
11
- if config.respond_to?(:assets) and not config.assets.nil?
13
+ if config.respond_to?(:assets) && !config.assets.nil?
12
14
  config.assets.configure do |env|
13
15
  AutoprefixerRails.install(env, config)
14
16
  end
15
17
  else
16
18
  initializer :setup_autoprefixer, group: :all do |app|
17
- if defined? app.assets and not app.assets.nil?
18
- AutoprefixerRails.install(app.assets, config)
19
- end
19
+ AutoprefixerRails.install(app.assets, config) if defined?(app.assets) && !app.assets.nil?
20
20
  end
21
21
  end
22
22
 
@@ -25,15 +25,16 @@ begin
25
25
  params = {}
26
26
 
27
27
  roots.each do |root|
28
- file = File.join(root, 'config/autoprefixer.yml')
28
+ file = File.join(root, "config/autoprefixer.yml")
29
+
30
+ next unless File.exist?(file)
31
+
32
+ parsed = ::YAML.load_file(file)
33
+ next unless parsed
29
34
 
30
- if File.exist?(file)
31
- parsed = ::YAML.load_file(file)
32
- next unless parsed
33
- params = parsed
35
+ params = parsed
34
36
 
35
- break
36
- end
37
+ break
37
38
  end
38
39
 
39
40
  params = params.symbolize_keys
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AutoprefixerRails
2
4
  # Container of prefixed CSS and source map with changes
3
5
  class Result
@@ -1,4 +1,6 @@
1
- require 'pathname'
1
+ # frozen_string_literal: true
2
+
3
+ require "pathname"
2
4
 
3
5
  module AutoprefixerRails
4
6
  # Register autoprefixer postprocessor in Sprockets and fix common issues
@@ -16,11 +18,11 @@ module AutoprefixerRails
16
18
 
17
19
  # Add prefixes to `css`
18
20
  def self.run(filename, css)
19
- output = filename.chomp(File.extname(filename)) + '.css'
21
+ output = filename.chomp(File.extname(filename)) + ".css"
20
22
  result = @processor.process(css, from: filename, to: output)
21
23
 
22
24
  result.warnings.each do |warning|
23
- $stderr.puts "autoprefixer: #{ warning }"
25
+ warn "autoprefixer: #{warning}"
24
26
  end
25
27
 
26
28
  result.css
@@ -29,29 +31,29 @@ module AutoprefixerRails
29
31
  # Register postprocessor in Sprockets depend on issues with other gems
30
32
  def self.install(env)
31
33
  if ::Sprockets::VERSION.to_f < 4
32
- env.register_postprocessor('text/css',
33
- ::AutoprefixerRails::Sprockets)
34
+ env.register_postprocessor("text/css",
35
+ ::AutoprefixerRails::Sprockets)
34
36
  else
35
- env.register_bundle_processor('text/css',
36
- ::AutoprefixerRails::Sprockets)
37
+ env.register_bundle_processor("text/css",
38
+ ::AutoprefixerRails::Sprockets)
37
39
  end
38
40
  end
39
41
 
40
42
  # Register postprocessor in Sprockets depend on issues with other gems
41
43
  def self.uninstall(env)
42
44
  if ::Sprockets::VERSION.to_f < 4
43
- env.unregister_postprocessor('text/css',
44
- ::AutoprefixerRails::Sprockets)
45
+ env.unregister_postprocessor("text/css",
46
+ ::AutoprefixerRails::Sprockets)
45
47
  else
46
- env.unregister_bundle_processor('text/css',
47
- ::AutoprefixerRails::Sprockets)
48
+ env.unregister_bundle_processor("text/css",
49
+ ::AutoprefixerRails::Sprockets)
48
50
  end
49
51
  end
50
52
 
51
53
  # Sprockets 2 API new and render
52
- def initialize(filename, &block)
54
+ def initialize(filename)
53
55
  @filename = filename
54
- @source = block.call
56
+ @source = yield
55
57
  end
56
58
 
57
59
  # Sprockets 2 API new and render
@@ -1,3 +1,5 @@
1
- module AutoprefixerRails
2
- VERSION = '9.4.8'.freeze unless defined? AutoprefixerRails::VERSION
1
+ # frozen_string_literal: true
2
+
3
+ module AutoprefixerRails # :nodoc:
4
+ VERSION = "9.8.6.5" unless defined? AutoprefixerRails::VERSION
3
5
  end
@@ -1,21 +1,24 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Ruby integration with Autoprefixer JS library, which parse CSS and adds
2
4
  # only actual prefixed
3
5
  module AutoprefixerRails
4
- autoload :Sprockets, 'autoprefixer-rails/sprockets'
6
+ autoload :Sprockets, "autoprefixer-rails/sprockets"
5
7
 
6
8
  # Add prefixes to `css`. See `Processor#process` for options.
7
- def self.process(css, opts = { })
8
- params = { }
9
- params[:browsers] = opts.delete(:browsers) if opts.has_key?(:browsers)
10
- params[:cascade] = opts.delete(:cascade) if opts.has_key?(:cascade)
11
- params[:remove] = opts.delete(:remove) if opts.has_key?(:remove)
12
- params[:env] = opts.delete(:env) if opts.has_key?(:env)
9
+ def self.process(css, opts = {})
10
+ params = {}
11
+ params[:overrideBrowserslist] = opts.delete(:overrideBrowserslist) if opts.key?(:overrideBrowserslist)
12
+ params[:browsers] = opts.delete(:browsers) if opts.key?(:browsers)
13
+ params[:cascade] = opts.delete(:cascade) if opts.key?(:cascade)
14
+ params[:remove] = opts.delete(:remove) if opts.key?(:remove)
15
+ params[:env] = opts.delete(:env) if opts.key?(:env)
13
16
  processor(params).process(css, opts)
14
17
  end
15
18
 
16
19
  # Add Autoprefixer for Sprockets environment in `assets`.
17
20
  # You can specify `browsers` actual in your project.
18
- def self.install(assets, params = { })
21
+ def self.install(assets, params = {})
19
22
  Sprockets.register_processor(processor(params))
20
23
  Sprockets.install(assets)
21
24
  end
@@ -26,13 +29,13 @@ module AutoprefixerRails
26
29
  end
27
30
 
28
31
  # Cache processor instances
29
- def self.processor(params = { })
32
+ def self.processor(params = {})
30
33
  Processor.new(params)
31
34
  end
32
35
  end
33
36
 
34
- require_relative 'autoprefixer-rails/result'
35
- require_relative 'autoprefixer-rails/version'
36
- require_relative 'autoprefixer-rails/processor'
37
+ require_relative "autoprefixer-rails/result"
38
+ require_relative "autoprefixer-rails/version"
39
+ require_relative "autoprefixer-rails/processor"
37
40
 
38
- require_relative 'autoprefixer-rails/railtie' if defined?(Rails)
41
+ require_relative "autoprefixer-rails/railtie" if defined?(Rails)
@@ -1,6 +1,8 @@
1
- require 'rake'
2
- require 'rake/tasklib'
3
- require 'autoprefixer-rails'
1
+ # frozen_string_literal: true
2
+
3
+ require "rake"
4
+ require "rake/tasklib"
5
+ require "autoprefixer-rails"
4
6
 
5
7
  module Rake
6
8
  # Define task to inspect Autoprefixer browsers, properties and values.
@@ -18,7 +20,7 @@ module Rake
18
20
 
19
21
  def define
20
22
  namespace :autoprefixer do
21
- desc 'Show selected browsers and prefixed CSS properties and values'
23
+ desc "Show selected browsers and prefixed CSS properties and values"
22
24
  task :info do
23
25
  puts @processor.info
24
26
  end
data/spec/app/Rakefile CHANGED
@@ -1,2 +1,4 @@
1
- require File.expand_path('../config/application', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("config/application", __dir__)
2
4
  App::Application.load_tasks