Question

I'm testing something out with my development environment where I'm precomiling assets locally then rsyncing it to the production server.

However, when I'm use Pow it serves the /public/assets/ folder which includes the minified css and js files.

I wanted to know how to tackle this problem.

How do you ignore the public/assets with the Pow configuration?

Many thanks

Était-ce utile?

La solution

This sort of process (precompiling locally and pushing assets to the server independent of the code coming from your VCS) is common. I use a custom implementation of this strategy as part of my deploys through Capistrano.

There is a separate rake task to run after the assets have been synced.

rake assets:clean

This will flush the assets from public/assets locally, allowing you to continue development with assets being pulled from app/assets/, lib/assets/, vendor/assets/, etc...

I'm pretty certain what you're asking for can't be doen with Pow itself. There is an interesting Rails Issue about this, specifically, this comment

config/environments/development.rb

config.serve_static_assets = false

config/routes.rb (at the very end)

if Rails.env.development?
  app = ActionDispatch::Static.new(
    lambda{ |env| [404, { 'X-Cascade' => 'pass'}, []] },
    Rails.application.config.paths['public'].first,
    Rails.application.config.static_cache_control
  )

  mount app, :at => '/', :as => :public
end

I've not tested this myself.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top