Skip to content

Commit

Permalink
Add exception and comments to explain the issue
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDaugherty committed Jun 14, 2023
1 parent 8b1e2c9 commit fde3b70
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/better_errors/error_page_style.rb
Expand Up @@ -2,7 +2,20 @@ module BetterErrors
# @private
module ErrorPageStyle
def self.compiled_css(for_deployment = false)
require "sassc"
begin
require "sassc"
rescue LoadError
raise LoadError, "The `sassc` gem is required when developing the `better_errors` gem. "\
"If you're using a release of `better_errors`, the compiled CSS is missing from the released gem"
# If you arrived here because sassc is not in your project's Gemfile,
# the issue here is that the release of the better_errors gem
# is supposed to contain the compiled CSS, but that file is missing from the release.
# So better_errors is trying to build the CSS on the fly, which requires the sassc gem.
#
# If you're developing the better_errors gem locally, and you're running a project
# that does not have sassc in its bundle, run `rake style:build` in the better_errors
# project to compile the CSS file.
end

style_dir = File.expand_path("style", File.dirname(__FILE__))
style_file = "#{style_dir}/main.scss"
Expand Down

0 comments on commit fde3b70

Please sign in to comment.