Skip to content

Commit f1f92e0

Browse files
committedJul 31, 2024
Make autoprefixer dependency optional
See #277
1 parent f240cae commit f1f92e0

13 files changed

+3
-26
lines changed
 

‎README.md

+3-8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ This gem requires a Sass engine, so make sure you have **one** of these two gems
3232

3333
Also ensure that `sprockets-rails` is at least v2.3.2.
3434

35+
For wider browser compatibility, use [Autoprefixer][autoprefixer].
36+
If you are using Rails, add the `autoprefixer-rails` gem to your app and ensure you have a JavaScript runtime (e.g. NodeJS).
37+
3538
`bundle install` and restart your server to make the files available through the pipeline.
3639

3740
Import Bootstrap styles in `app/assets/stylesheets/application.scss`:
@@ -113,14 +116,6 @@ Refer to your framework's documentation on the subject.
113116

114117
## Configuration
115118

116-
### Sass: Autoprefixer
117-
118-
Bootstrap requires the use of [Autoprefixer][autoprefixer].
119-
[Autoprefixer][autoprefixer] adds vendor prefixes to CSS rules using values from [Can I Use](http://caniuse.com/).
120-
121-
If you are using bootstrap with Rails, autoprefixer is set up for you automatically.
122-
Otherwise, please consult the [Autoprefixer documentation][autoprefixer].
123-
124119
### Sass: Individual components
125120

126121
By default all of Bootstrap is imported.

‎Rakefile

-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ task :debug do
5757
end
5858
require './lib/bootstrap'
5959
require 'term/ansicolor'
60-
require 'autoprefixer-rails'
6160
path = Bootstrap.stylesheets_path
6261
%w(_bootstrap _bootstrap-reboot _bootstrap-grid).each do |file|
6362
filename = "#{path}/#{file}.scss"
@@ -66,7 +65,6 @@ task :debug do
6665
else
6766
Sass.compile(filename).css
6867
end
69-
css = AutoprefixerRails.process(css)
7068
out = File.join('tmp', "#{file[1..-1]}.css")
7169
File.write(out, css)
7270
$stderr.puts Term::ANSIColor.green "Compiled #{out}"

‎bootstrap.gemspec

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Gem::Specification.new do |s|
1515
s.required_ruby_version = '>= 2.3.3'
1616

1717
s.add_runtime_dependency 'popper_js', '>= 2.11.8', '< 3'
18-
s.add_runtime_dependency 'autoprefixer-rails', '>= 9.1.0'
1918

2019
s.add_development_dependency 'rake'
2120

‎lib/bootstrap/engine.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# frozen_string_literal: true
22

3-
require 'autoprefixer-rails'
43
begin
54
require 'dartsass-sprockets'
65
rescue LoadError

‎test/dummy_rails/config/application.rb

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
require "#{framework}/railtie"
1111
end
1212

13-
require 'autoprefixer-rails'
1413
require 'uglifier'
1514
require 'bootstrap'
1615

@@ -29,4 +28,3 @@ class Application < Rails::Application
2928
end
3029
end
3130
end
32-

‎test/gemfiles/rails_5_0.gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ source 'https://rubygems.org'
22

33
gem 'actionpack', '~> 5.0.0'
44
gem 'activesupport', '~> 5.0.0'
5-
gem 'autoprefixer-rails', '>= 6.3.6.1'
65
gem 'sassc-rails', '~> 2.0'
76

87
gemspec path: '../../'

‎test/gemfiles/rails_5_1.gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ source 'https://rubygems.org'
22

33
gem 'actionpack', '~> 5.1.0'
44
gem 'activesupport', '~> 5.1.0'
5-
gem 'autoprefixer-rails', '>= 7.1.1'
65
gem 'sassc-rails', '~> 2.0'
76

87
gemspec path: '../../'

‎test/gemfiles/rails_5_2.gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ source 'https://rubygems.org'
22

33
gem 'actionpack', '~> 5.2.8'
44
gem 'activesupport', '~> 5.2.8'
5-
gem 'autoprefixer-rails', '>= 7.1.1'
65
gem 'sassc-rails', '~> 2.0'
76

87
gemspec path: '../../'

‎test/gemfiles/rails_6_0.gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ source 'https://rubygems.org'
22

33
gem 'actionpack', '~> 6.0.3'
44
gem 'activesupport', '~> 6.0.3'
5-
gem 'autoprefixer-rails', '>= 9.7.6'
65
gem 'sassc-rails', '~> 2.0'
76

87
gemspec path: '../../'

‎test/gemfiles/rails_6_1.gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ source 'https://rubygems.org'
22

33
gem 'actionpack', '~> 6.1.3'
44
gem 'activesupport', '~> 6.1.3'
5-
gem 'autoprefixer-rails', '>= 9.7.6'
65
gem 'sassc-rails', '~> 2.0'
76

87
gemspec path: '../../'

‎test/gemfiles/rails_7_0_dartsass.gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ source 'https://rubygems.org'
22

33
gem 'actionpack', '~> 7.0.4'
44
gem 'activesupport', '~> 7.0.4'
5-
gem 'autoprefixer-rails', '>= 9.7.6'
65
gem 'dartsass-sprockets', '~> 3.0'
76

87
gemspec path: '../../'

‎test/gemfiles/rails_7_0_sassc.gemfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ source 'https://rubygems.org'
22

33
gem 'actionpack', '~> 7.0.4'
44
gem 'activesupport', '~> 7.0.4'
5-
gem 'autoprefixer-rails', '>= 9.7.6'
65
gem 'sassc-rails', '~> 2.0'
76

87
gemspec path: '../../'

‎test/rails_test.rb

-5
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ def test_visit_root
1212
screenshot!
1313
end
1414

15-
def test_autoprefixer
16-
get ActionController::Base.helpers.stylesheet_path('application.css')
17-
assert_match(/-webkit-(?:transition|transform)/, response.body)
18-
end
19-
2015
def test_precompile
2116
Dummy::Application.load_tasks
2217
Rake::Task['assets:precompile'].invoke

0 commit comments

Comments
 (0)