Skip to content

Commit

Permalink
Make autoprefixer dependency optional
Browse files Browse the repository at this point in the history
  • Loading branch information
glebm committed Jul 31, 2024
1 parent f240cae commit f1f92e0
Show file tree
Hide file tree
Showing 13 changed files with 3 additions and 26 deletions.
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ This gem requires a Sass engine, so make sure you have **one** of these two gems

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

For wider browser compatibility, use [Autoprefixer][autoprefixer].
If you are using Rails, add the `autoprefixer-rails` gem to your app and ensure you have a JavaScript runtime (e.g. NodeJS).

`bundle install` and restart your server to make the files available through the pipeline.

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

## Configuration

### Sass: Autoprefixer

Bootstrap requires the use of [Autoprefixer][autoprefixer].
[Autoprefixer][autoprefixer] adds vendor prefixes to CSS rules using values from [Can I Use](http://caniuse.com/).

If you are using bootstrap with Rails, autoprefixer is set up for you automatically.
Otherwise, please consult the [Autoprefixer documentation][autoprefixer].

### Sass: Individual components

By default all of Bootstrap is imported.
Expand Down
2 changes: 0 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ task :debug do
end
require './lib/bootstrap'
require 'term/ansicolor'
require 'autoprefixer-rails'
path = Bootstrap.stylesheets_path
%w(_bootstrap _bootstrap-reboot _bootstrap-grid).each do |file|
filename = "#{path}/#{file}.scss"
Expand All @@ -66,7 +65,6 @@ task :debug do
else
Sass.compile(filename).css
end
css = AutoprefixerRails.process(css)
out = File.join('tmp', "#{file[1..-1]}.css")
File.write(out, css)
$stderr.puts Term::ANSIColor.green "Compiled #{out}"
Expand Down
1 change: 0 additions & 1 deletion bootstrap.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 2.3.3'

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

s.add_development_dependency 'rake'

Expand Down
1 change: 0 additions & 1 deletion lib/bootstrap/engine.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require 'autoprefixer-rails'
begin
require 'dartsass-sprockets'
rescue LoadError
Expand Down
2 changes: 0 additions & 2 deletions test/dummy_rails/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
require "#{framework}/railtie"
end

require 'autoprefixer-rails'
require 'uglifier'
require 'bootstrap'

Expand All @@ -29,4 +28,3 @@ class Application < Rails::Application
end
end
end

1 change: 0 additions & 1 deletion test/gemfiles/rails_5_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source 'https://rubygems.org'

gem 'actionpack', '~> 5.0.0'
gem 'activesupport', '~> 5.0.0'
gem 'autoprefixer-rails', '>= 6.3.6.1'
gem 'sassc-rails', '~> 2.0'

gemspec path: '../../'
1 change: 0 additions & 1 deletion test/gemfiles/rails_5_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source 'https://rubygems.org'

gem 'actionpack', '~> 5.1.0'
gem 'activesupport', '~> 5.1.0'
gem 'autoprefixer-rails', '>= 7.1.1'
gem 'sassc-rails', '~> 2.0'

gemspec path: '../../'
1 change: 0 additions & 1 deletion test/gemfiles/rails_5_2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source 'https://rubygems.org'

gem 'actionpack', '~> 5.2.8'
gem 'activesupport', '~> 5.2.8'
gem 'autoprefixer-rails', '>= 7.1.1'
gem 'sassc-rails', '~> 2.0'

gemspec path: '../../'
1 change: 0 additions & 1 deletion test/gemfiles/rails_6_0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source 'https://rubygems.org'

gem 'actionpack', '~> 6.0.3'
gem 'activesupport', '~> 6.0.3'
gem 'autoprefixer-rails', '>= 9.7.6'
gem 'sassc-rails', '~> 2.0'

gemspec path: '../../'
1 change: 0 additions & 1 deletion test/gemfiles/rails_6_1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source 'https://rubygems.org'

gem 'actionpack', '~> 6.1.3'
gem 'activesupport', '~> 6.1.3'
gem 'autoprefixer-rails', '>= 9.7.6'
gem 'sassc-rails', '~> 2.0'

gemspec path: '../../'
1 change: 0 additions & 1 deletion test/gemfiles/rails_7_0_dartsass.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source 'https://rubygems.org'

gem 'actionpack', '~> 7.0.4'
gem 'activesupport', '~> 7.0.4'
gem 'autoprefixer-rails', '>= 9.7.6'
gem 'dartsass-sprockets', '~> 3.0'

gemspec path: '../../'
1 change: 0 additions & 1 deletion test/gemfiles/rails_7_0_sassc.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ source 'https://rubygems.org'

gem 'actionpack', '~> 7.0.4'
gem 'activesupport', '~> 7.0.4'
gem 'autoprefixer-rails', '>= 9.7.6'
gem 'sassc-rails', '~> 2.0'

gemspec path: '../../'
5 changes: 0 additions & 5 deletions test/rails_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ def test_visit_root
screenshot!
end

def test_autoprefixer
get ActionController::Base.helpers.stylesheet_path('application.css')
assert_match(/-webkit-(?:transition|transform)/, response.body)
end

def test_precompile
Dummy::Application.load_tasks
Rake::Task['assets:precompile'].invoke
Expand Down

0 comments on commit f1f92e0

Please sign in to comment.