0
我正在尝试将动态云端资源完整路径添加到我的scss中。基于所述环境现状(分段等)Rails 4配置和erb in scss for conditional cloudfront paths
mystyle.scss
.some-image {background-image: url(asset_path("#{Rails.configuration.adjusted_s3_cloudfront_path}landing/this-image.jpg"))}
或mystyle.scss
.some-image {background-image: url(Rails.configuration.adjusted_s3_cloudfront_path('/landing/this-image.jpg'))}
或mystyle.scss.erb
.some-image {background-image: url(<% Rails.configuration.adjusted_s3_cloudfront_path %>"/landing/this-image.jpg")}
路径变化development.rb
config.adjusted_s3_cloudfront_path = "https://somecloufrontnumber.cloudfront.net"
production.rb
config.adjusted_s3_cloudfront_path = "https://#{ENV['S3_CLOUDFRONT_URL']}"