导入的 glob 模式在生产中不起作用 sass-rails

Import's with glob pattern not working in production sass-rails

出于某种原因,任何时候我使用 sass glob 模式(例如 @import "recommends/**/*"; )然后去编译我的资产用于生产(它在开发中工作)它不工作(正在抛出一个File to import not found or unreadable 错误`).

关于我没有考虑的任何想法?

宝石文件:

source "https://rubygems.org"

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

gem "rails"
gem "puma"
gem "dotenv-rails"
gem "newrelic_rpm"
gem "simple_form"
gem "timeliness"
gem "validates_timeliness"
gem "responders"
gem "better_errors"
gem "parsley-rails"
gem "jquery-rails"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]

source "[...]" do
  gem "apophenia-rails-logger"
  gem "dr_theme", "~> 5"
  gem "lead"
  gem "ramsey_validators"
end

group :development, :test, :build do
  gem "sass-rails", "~> 5.0"
  gem "autoprefixer-rails"
  gem "sprockets-es6"
end

group :development, :test do
  # Call "byebug" anywhere in the code to stop execution and get a debugger console
  gem "byebug", platform: :mri
  gem "rspec-rails"
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem "web-console", ">= 3.3.0"
  gem "listen", "~> 3.0.5"
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem "spring"
  gem "spring-watcher-listen", "~> 2.0.0"
  gem "spring-commands-rspec"

  gem "fuubar"
  gem "vcr"
  gem "webmock", require: false
  gem "capybara"
  gem "poltergeist"

  gem "i18n-debug", require: false # turn this on to log out I18n localization lookups
end

group :production do
  gem "uglifier"
end

定义

gem "sass-rails" 

外部开发块,然后 运行

bundle install 

并尝试 运行 通过

在生产环境中使用本地服务器
rails s -e production

希望这能解决您的问题。快乐编码:)