Reputation: 2998
I'm trying to enable direct access to this file: http://example.com/assets/style.css
(located in /assets/stylesheets/style.css
)
It works in development, but I get a 404 error in production.
config/initializers/assets.rb:
Rails.application.config.assets.version = '1.0'
Rails.application.config.assets.precompile += %w( static_pages.css )
Rails.application.config.assets.precompile += %w( dashboard.css )
Rails.application.config.assets.precompile += %w( style.css )
config/initializers/production.rb:
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_assets = true
config.assets.js_compressor = :uglifier
config.assets.compile = true
config.assets.digest = true
config.force_ssl = false
config.log_level = :debug
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.log_formatter = ::Logger::Formatter.new
config.active_record.dump_schema_after_migration = false
Upvotes: 0
Views: 235
Reputation: 9961
Because Rails Asset Pipeline precompille assets and add fingerprint. You should use Asset Pipeline Helpers instead of hardcoding http://example.com/assets/jquery-ui-slider-pips.css
.
If you want to use JS or CSS files without Asset Pipeline just put them to public
directory (or any sub-directory of public
directory) and use direct link. i.e. for public/style1.css
file you can use URL http://example.com/style1.css
Upvotes: 1