ruby-on-railsbootstrap-4sassbootstrap-ui

Error compiling assets after upgrading bootstrap


I'm trying to upgrade the bootstrap version in a Ruby on Rails application. After migratinng from 4.0.0-alpha.6 to 4.1 using yarn I get this error when running rails assets:precompile

error

SassC::SyntaxError: Error: Undefined variable: "$alert-warning-bg".
        on line 32:20 of app/assets/stylesheets/variables/_helpers.scss
        from line 47:9 of app/assets/stylesheets/variables.scss
        from line 9:9 of app/assets/stylesheets/application.scss
        from line 1:9 of app/assets/stylesheets/admin.scss
>>   outline: lighten($alert-warning-bg, 9%);

helper.scss

.highlight {
  outline: lighten($alert-warning-bg, 9%);
}

Solution

  • $alert-warning-bg was removed on 4.1 and replaced with theme-color-level($color, $alert-bg-level) mixin (to make it DRY?). usage example:

    theme-color-level('warning', $alert-bg-level)
    

    or specifically on your case:

    lighten(theme-color-level('warning', $alert-bg-level), 9%)