javascript - How to compress the js, css files in /public in Rails production mode -
i set bunch of javascript plug-ins , images, css within rails project.
this structure.
public/css public/js public/images
i added
config.assets.compile = true config.serve_static_assets = true
in production.rb
and compresses fine, if files within /app/assets/
what external plug-ins?
what have compress whole bunch of libs within /public??
asset pipeline
you're missing point of asset pipeline
; precompilation
process:
rails comes bundled rake task compile asset manifests , other files in pipeline.
compiled assets written location specified in config.assets.prefix. default, /assets directory.
you can phone call task on server during deployment create compiled versions of assets straight on server. see next section info on compiling locally.
--
precompilation
your question can answered precompile asset
- this, need able store relative asset files in app/assets/....
you can precompile assets in production using next command:
$ rake assets:precompile rails_env=production
this compress / minify various asset files different files allocate precompilation process. default, set application.*
(application.css
/ application.js
etc)
--
fix
to this, need move files app/assets/...
folders. puts them asset pipeline
, allow rails precompile assets correctly, sending them /public
folder required
javascript css ruby-on-rails
No comments:
Post a Comment