From 5d9ffcff4fc5b49c432aa022fc789e3a8f5d3535 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Fri, 10 May 2024 12:01:46 +0900 Subject: [PATCH] Make autoprefixer dependency optional See #277 --- README.md | 11 +++-------- Rakefile | 2 -- bootstrap.gemspec | 1 - lib/bootstrap/engine.rb | 1 - test/dummy_rails/config/application.rb | 2 -- test/gemfiles/rails_5_0.gemfile | 1 - test/gemfiles/rails_5_1.gemfile | 1 - test/gemfiles/rails_5_2.gemfile | 1 - test/gemfiles/rails_6_0.gemfile | 1 - test/gemfiles/rails_6_1.gemfile | 1 - test/gemfiles/rails_7_0_dartsass.gemfile | 1 - test/gemfiles/rails_7_0_sassc.gemfile | 1 - test/rails_test.rb | 5 ----- 13 files changed, 3 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index de578f6c..6e2c5c7e 100644 --- a/README.md +++ b/README.md @@ -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`: @@ -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. diff --git a/Rakefile b/Rakefile index fd1ae091..52402cce 100644 --- a/Rakefile +++ b/Rakefile @@ -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" @@ -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}" diff --git a/bootstrap.gemspec b/bootstrap.gemspec index 55b4f8f3..a0bd50c4 100644 --- a/bootstrap.gemspec +++ b/bootstrap.gemspec @@ -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' diff --git a/lib/bootstrap/engine.rb b/lib/bootstrap/engine.rb index 4d81db84..a907894e 100644 --- a/lib/bootstrap/engine.rb +++ b/lib/bootstrap/engine.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require 'autoprefixer-rails' begin require 'dartsass-sprockets' rescue LoadError diff --git a/test/dummy_rails/config/application.rb b/test/dummy_rails/config/application.rb index 1a6ae466..8ed1d8e2 100644 --- a/test/dummy_rails/config/application.rb +++ b/test/dummy_rails/config/application.rb @@ -10,7 +10,6 @@ require "#{framework}/railtie" end -require 'autoprefixer-rails' require 'uglifier' require 'bootstrap' @@ -29,4 +28,3 @@ class Application < Rails::Application end end end - diff --git a/test/gemfiles/rails_5_0.gemfile b/test/gemfiles/rails_5_0.gemfile index 11cd1134..a18643d4 100644 --- a/test/gemfiles/rails_5_0.gemfile +++ b/test/gemfiles/rails_5_0.gemfile @@ -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: '../../' diff --git a/test/gemfiles/rails_5_1.gemfile b/test/gemfiles/rails_5_1.gemfile index 884edc86..13f942c8 100644 --- a/test/gemfiles/rails_5_1.gemfile +++ b/test/gemfiles/rails_5_1.gemfile @@ -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: '../../' diff --git a/test/gemfiles/rails_5_2.gemfile b/test/gemfiles/rails_5_2.gemfile index 18e980f1..767833c5 100644 --- a/test/gemfiles/rails_5_2.gemfile +++ b/test/gemfiles/rails_5_2.gemfile @@ -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: '../../' diff --git a/test/gemfiles/rails_6_0.gemfile b/test/gemfiles/rails_6_0.gemfile index a92758dd..daeffa5f 100644 --- a/test/gemfiles/rails_6_0.gemfile +++ b/test/gemfiles/rails_6_0.gemfile @@ -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: '../../' diff --git a/test/gemfiles/rails_6_1.gemfile b/test/gemfiles/rails_6_1.gemfile index a9b7f232..04342fbb 100644 --- a/test/gemfiles/rails_6_1.gemfile +++ b/test/gemfiles/rails_6_1.gemfile @@ -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: '../../' diff --git a/test/gemfiles/rails_7_0_dartsass.gemfile b/test/gemfiles/rails_7_0_dartsass.gemfile index 8e38137e..6df9142d 100644 --- a/test/gemfiles/rails_7_0_dartsass.gemfile +++ b/test/gemfiles/rails_7_0_dartsass.gemfile @@ -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: '../../' diff --git a/test/gemfiles/rails_7_0_sassc.gemfile b/test/gemfiles/rails_7_0_sassc.gemfile index 28a4d05f..58fc0395 100644 --- a/test/gemfiles/rails_7_0_sassc.gemfile +++ b/test/gemfiles/rails_7_0_sassc.gemfile @@ -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: '../../' diff --git a/test/rails_test.rb b/test/rails_test.rb index 046641e0..fc67b83d 100644 --- a/test/rails_test.rb +++ b/test/rails_test.rb @@ -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