Bootstrap-sass和Bootstrap在/不兼容的单位上创建`Sass :: UnitConversionError:'rem'和'px'。

时间:2019-01-25 03:38:26

标签: css ruby-on-rails twitter-bootstrap sass mdbootstrap

我正在我的Rails 5.2应用程序中同时使用Spree(使用bootstrap-sass)和Material Design Bootstrap(https://mdbootstrap.com/),但这种组合产生了一些不幸的错误。

具体来说,当我尝试加载任何页面时,都会引发此错误:

Sass::UnitConversionError at /
Incompatible units: 'rem' and 'px'.

在查找此错误时,我看到类似thisthisthis之类的帖子,这表明使用带rem和px的calc出现此错误。但是,它在vendor/assets/stylesheets/mdb/core/bootstrap/_variables.scss的以下行中被调用:

$input-height-inner: ($font-size-base * $input-btn-line-height) + ($input-btn-padding-y * 2) !default;

我已经检查了每个对应的变量,它们都不涉及px值。

$font-size-base: 1rem !default; // Assumes the browser default, typically `16px`

$input-btn-line-height: $line-height-base !default;

并依次

$line-height-base: 1.5 !default;

最后

$input-btn-padding-y: .375rem !default;

我的gemfile当前是这样的:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5.0'

gem 'rails', '~> 5.2.1'
gem 'puma', '~> 3.11'
gem 'puma_worker_killer'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jbuilder', '~> 2.5'
gem 'mini_magick', '~> 4.8.0'
gem 'devise'
gem 'bootsnap'
# gem 'bootstrap', '~> 4.2.1'
gem 'jquery-ui-rails'
gem 'sprockets-rails'
gem 'bootstrap-sass'
gem 'bcrypt', '~> 3.1.7'
gem 'friendly_id', '~> 5.2.0'
gem 'stripe'
gem 'figaro'
gem 'magnific-popup-rails', '~> 1.1.0'
gem 'simple_form'
gem 'acts-as-taggable-on', '~> 6.0' #must be this version for Rails5
gem 'aws-sdk' , '~> 3'
gem 'aws-sdk-s3', require: false
# gem 'simple_form_extension'
gem 'recaptcha', require: "recaptcha/rails"
gem 'font-awesome-rails'
gem 'font-awesome-sass'
gem 'font_awesome5_rails'
# gem 'trix-rails', require: 'trix'
gem 'rack-tracker'
gem 'high_voltage', '~> 3.1'
gem 'convertkit-ruby', require: 'convertkit'
gem 'dotenv-rails'
gem 'acts_as_list'
gem 'wysiwyg-rails'
gem 'will_paginate'
gem 'searchkick'

gem 'spree', '~> 3.7.0.rc1'
gem 'spree_gateway', '~> 3.4'
gem 'spree_remove_bs3', github: 'matthewkennedy/spree_remove_bs3'
gem 'spree_bs4', github: 'matthewkennedy/spree_bs4'

group :production do
  gem 'pg', '~> 0.20.0'
end

group :development, :test do
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'pg', '~> 0.20.0'
end

group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
  gem 'binding_of_caller'
  gem 'better_errors'
  gem 'pg', '~> 0.20.0'
end

group :test do
  gem 'capybara', '>= 2.15', '< 4.0'
  gem 'selenium-webdriver'
  gem 'chromedriver-helper'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

我的application.scss中有以下导入/要求:

 *= require magnific-popup
 *= require jquery-ui
 *= require_tree .
 *= require_self
 */

@import "bootstrap-sprockets";
@import "bootstrap";
@import 'font_awesome5_webfont';
@import 'font_awesome5.css';
@import 'bootstrap-datetimepicker';
@import 'froala_editor.min';
@import 'froala_style.min';
@import 'font-awesome-sprockets';
@import 'font-awesome';
@import 'plugins/char_counter.min.css';
@import 'plugins/code_view.min.css';
@import 'plugins/colors.min.css';
@import 'plugins/fullscreen.min.css';
@import 'plugins/image_manager.min.css';
@import 'plugins/image.min.css';
@import 'plugins/line_breaker.min.css';
@import 'plugins/quick_insert.min.css';
@import 'plugins/special_characters.min.css';
@import 'plugins/table.min.css';
@import 'third_party/embedly.min.css';
@import 'third_party/spell_checker.min.css';
@import 'mdb/mdb';

有人可以帮助我控制这个sass错误吗?在修正此问题之前,该应用程序完全无法使用,因为每个页面上都有错误。

0 个答案:

没有答案