Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Works, but browser reload takes still quite long? #20

Open
jmuheim opened this Issue Jun 28, 2012 · 2 comments

Comments

Projects
None yet
2 participants

jmuheim commented Jun 28, 2012

Hey there

I use guard-rails-assets and guard-livereload. Everything works, but it seems to me that after guard-rails-assets has finished compiling, the automatically reloaded browser still takes quite long to reload. Every next reload is way faster.

This seems to me like guard-rails-assets compiles the assets, but then when reloading, rails compiles once again!

Could this be true? Or is this behavior normal?

By the way, since I added your guard-rails-assets, when stopping guard, Rails doesn't succeed to compile the assets itself anymore. I have commented out the gem, restarted the server, but nothing happens when I change e.g. the application.scss file.

Owner

dnagir commented Jun 29, 2012

It's hard to tell what and why all of that happens.

A few pointer that may help though:

  • guard-rails-assets works as you would precompile assets manually, so make sure the precompilation works as expected.
  • if you use :runner => :rails option (which is the default), then the rails is loaded in-process. It is fast, but it will conflict and can mess things up if you are loading a rails environment in-process from another guard (like guard-rails). The workaround is to use :runner => :cli, which will make it slow, but reliable.
  • the default environment for precompilation is :rails_env => :test, this will precompile assets when they are changed for test environment. But then when you reload the browser, Rails has to precompile the assets for development environment.

The last point is probably the most important. If you run rails in development environment, you don't need to precompile assets at all. Rails does that by default. So the use of guard-rails-assets is just pointless here.

It will cause conflicts since the static files in public/assets will be served instead of actual assets that you are working on.

The purpose of this gem was to precompile assets for running javascript tests through jasmine.
Since there's Jasminerice gem, the guard-rails-assets is somewhat obsolete.

One more time, you should not precompile assets in development environment because rails will do it automatically.

So delete the public/assets directory and get rid of guard-rails-assets if you are using it for browser reload.

jmuheim commented Jul 12, 2012

(FYI: I haven't forgotten about this, but don't have time for further investigation right now. I will get back to it later hopefully.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment