spree / deface

Rails plugin that allows you to customize ERB views in a Rails application without editing the underlying view.
MIT License
519 stars 128 forks source link

Deface precompiling in production not working #102

Open keilmillerjr opened 11 years ago

keilmillerjr commented 11 years ago

A while ago I made a comment on google groups about my site missing the login/account/logout links in production. I received a response 10 days later stating that it might be an issue with deface and precompiling. Upon closer notice, he was right! My deface override is not being applied. Forgive me for continuing the conversation here, but I missed his comment until now because google groups is a bit difficult for me to use.

production.rb

Disable Deface once precompiling is used to prevent overrides getting applied twice

config.deface.enabled = false

I must have overlooked or forgotten the part in the deface docs about having to precompile. So I run the precompile command to my heroku production app and get the following results.

$ heroku run rake deface:precompile --remote heroku_production Running rake deface:precompile attached to terminal... up, run.9755 DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7) DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7) DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)

It appears that nothing happens other than the normal heroku plugin warnings that happen with everything, even if there are no plugins present.

I restart my app and there are no changes. It seems as though the precompile did not work. Do you guys have any ideas?

keilmillerjr commented 11 years ago

A bunch of searching and I was able to find this post. I think I have to run the deface precompile command on an environment such as development where deface is enabled. So I could compile and push the new compiled_views directory to heroku. However, this causes overrides to be applied twice in an environment where deface is enabled.

How can I get spree/deface to ignore compiled_views when deface is enabled?

paynecodes commented 10 years ago

@keilmillerjr Any luck with this? Not having to precompile before deployment that is.

ardelio commented 8 years ago

@jpdesigndev for reference sake I have done the following:

# configs/environments/production.rb
config.deface.enabled = ENV['DEFACE_ENABLED'] == 'true'

in production environment, don't set that environment variable. Instead run the following rake command:

DEFACE_ENABLED=true bundle exec rake deface:precompile && rm -rf app/overrides