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
@@ -1,4 +1,6 @@
|
|
1
|
-
|
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)) +
|
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
|
-
|
25
|
+
warn "autoprefixer: #{warning}"
|
24
26
|
end
|
25
27
|
|
26
28
|
result.css
|
@@ -29,33 +31,33 @@ 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(
|
33
|
-
|
34
|
+
env.register_postprocessor("text/css",
|
35
|
+
::AutoprefixerRails::Sprockets)
|
34
36
|
else
|
35
|
-
env.register_bundle_processor(
|
36
|
-
|
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(
|
44
|
-
|
45
|
+
env.unregister_postprocessor("text/css",
|
46
|
+
::AutoprefixerRails::Sprockets)
|
45
47
|
else
|
46
|
-
env.unregister_bundle_processor(
|
47
|
-
|
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
|
54
|
+
def initialize(filename)
|
53
55
|
@filename = filename
|
54
|
-
@source =
|
56
|
+
@source = yield
|
55
57
|
end
|
56
58
|
|
57
59
|
# Sprockets 2 API new and render
|
58
|
-
def render(
|
60
|
+
def render(*)
|
59
61
|
self.class.run(@filename, @source)
|
60
62
|
end
|
61
63
|
end
|
data/lib/autoprefixer-rails.rb
CHANGED
@@ -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,
|
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[:
|
10
|
-
params[:
|
11
|
-
params[:
|
12
|
-
params[:
|
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
|
35
|
-
require_relative
|
36
|
-
require_relative
|
37
|
+
require_relative "autoprefixer-rails/result"
|
38
|
+
require_relative "autoprefixer-rails/version"
|
39
|
+
require_relative "autoprefixer-rails/processor"
|
37
40
|
|
38
|
-
require_relative
|
41
|
+
require_relative "autoprefixer-rails/railtie" if defined?(Rails)
|
@@ -1,6 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
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
|
23
|
+
desc "Show selected browsers and prefixed CSS properties and values"
|
22
24
|
task :info do
|
23
25
|
puts @processor.info
|
24
26
|
end
|