rails / sass-rails

Ruby on Rails stylesheet engine for Sass
MIT License
859 stars 331 forks source link

Error in production mode on RoR 7.0.3.1 with Bootstrap 5.2 #448

Open Sega100500 opened 2 years ago

Sega100500 commented 2 years ago

Ruby 3.1.2 Ruby on Rails 7.0.3.1 Third party library: Bootstrap 5.2 ( new version 5.2 released )

With bootstrap 5.1.3 (previous version) all works fine!

app/assets/config/manifest.js :

//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css

//= link lib/bootstrap/5.2.0/js/bootstrap.bundle.min.js
//= link lib/bootstrap/5.2.0/js/bootstrap.min.js
//= link lib/bootstrap/5.2.0/css/bootstrap.min.css

in view stylesheets and javascripts are attached via stylesheet_link_tag and javascript_include_tag

config/environments/production.rb :

config.assets.css_compressor = :sass

log/production.log :

I, [2022-08-04T22:18:02.411943 #21004]  INFO -- : [65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] Started GET "/" for 127.0.0.1 at 2022-08-04 22:18:02 +0500
I, [2022-08-04T22:18:02.414687 #21004]  INFO -- : [65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] Processing by ApplicationBaseController#index as HTML
I, [2022-08-04T22:18:02.422122 #21004]  INFO -- : [65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7]   Rendered application_base/index.html.erb within layouts/application (Duration: 0.8ms | Allocations: 318)
I, [2022-08-04T22:18:10.643746 #21004]  INFO -- : [65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7]   Rendered layout layouts/application.html.erb (Duration: 8222.5ms | Allocations: 366884)
I, [2022-08-04T22:18:10.644123 #21004]  INFO -- : [65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] Completed 500 Internal Server Error in 8229ms (ActiveRecord: 0.4ms | Allocations: 368805)
F, [2022-08-04T22:18:10.645185 #21004] FATAL -- : [65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7]   
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] ActionView::Template::Error (Error: Custom property values may not be empty.
        on line 6:68975 of stdin
>> -size:1.25rem;--bs-navbar-toggler-icon-bg:url("data:image/svg+xml,%3csvg 
   ------------------------------------------^
):
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7]   
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] stdin:6
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sassc (2.4.0) lib/sassc/engine.rb:50:in `render'
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sassc-rails (2.1.2) lib/sassc/rails/compressor.rb:29:in `call'
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sprockets (4.1.1) lib/sprockets/sass_compressor.rb:30:in `call'
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sprockets (4.1.1) lib/sprockets/processor_utils.rb:84:in `call_processor'
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sprockets (4.1.1) lib/sprockets/processor_utils.rb:66:in `block in call_processors'
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sprockets (4.1.1) lib/sprockets/processor_utils.rb:65:in `reverse_each'
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sprockets (4.1.1) lib/sprockets/processor_utils.rb:65:in `call_processors'
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sprockets (4.1.1) lib/sprockets/loader.rb:182:in `load_from_unloaded'
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sprockets (4.1.1) lib/sprockets/loader.rb:59:in `block in load'
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sprockets (4.1.1) lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sprockets (4.1.1) lib/sprockets/loader.rb:43:in `load'
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sprockets (4.1.1) lib/sprockets/cached_environment.rb:44:in `block in load'
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sprockets (4.1.1) lib/sprockets/cached_environment.rb:44:in `fetch'
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sprockets (4.1.1) lib/sprockets/cached_environment.rb:44:in `load'
[65dc8afa-0db3-4e0c-a7be-1b8fc43f79a7] sprockets (4.1.1) lib/sprockets/bundle.rb:32:in `block in call'

...
jotterlei commented 2 months ago

Curious if you ever had luck in fixing this issue? Just came across it today. @Sega100500

spohlenz commented 2 months ago

@jotterlei I've been able to find two solutions (apart from using a separate precompiler/bundler, e.g. cssbundling-rails):

1) Add the sassc-embedded gem to the Gemfile (keeping sass-rails or sassc-rails) 2) Replace sass-rails / sassc-rails in your Gemfile with dartsass-sprockets

jotterlei commented 2 months ago

Good to know thanks! I'll save this solution for when we schedule an upgrade.