spree_fancy icon indicating copy to clipboard operation
spree_fancy copied to clipboard

Unable to compile assets on production

Open grepruby opened this issue 11 years ago • 21 comments

Gem file entry: gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '1-3-stable'

I have added below line in application.rb

config.assets.precompile += %w( store/shared/_print.css )

But still getting another issue - Undefined variable: "$c_green"

could you please provide me guidance so that I can get do the proper assets compilation on production.

grepruby avatar Jul 03 '13 14:07 grepruby

Does this error happen when you run rake assets:precompile?

On Thu, Jul 4, 2013 at 12:35 AM, Grep Ruby [email protected] wrote:

Gem file entry: gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '1-3-stable' I have added below line in application.rb config.assets.precompile += %w( store/shared/_print.css ) But still getting another issue - Undefined variable: "$c_green"

could you please provide me guidance so that I can get do the proper assets compilation on production.

Reply to this email directly or view it on GitHub: https://github.com/spree/spree_fancy/issues/41

radar avatar Jul 03 '13 21:07 radar

Yes, when I am trying to deploy on heroku as well as running this command on my local on production mode.

grepruby avatar Jul 04 '13 08:07 grepruby

Same issue for me.

kennym avatar Jul 07 '13 05:07 kennym

I have fixed this issue from my end just by adding following gem out side of assets group in gem file:

gem 'compass' gem 'compass-rails'

Thanks Ryan to provide such a nice gem.

grepruby avatar Jul 11 '13 04:07 grepruby

@devilcoders Should we add these two gems as dependencies of spree_fancy?

radar avatar Jul 16 '13 00:07 radar

I'm seeing this issue right now with the 2-1-stable branch. I'm unable to compile spree_fancy's assets, and see the same $c_green error described above. If I neuter that line from the file, I just hit another one later.

Is anyone one else seeing this? I can't figure out if I'm doing something wrong or not.

I have added both compass and compass-rails as suggested above, and didn't seem to change anything. I went forward and backward a couple of compass major versions and didn't see the issue go away.

I'm stumped.

hexcodejosh avatar Oct 22 '13 23:10 hexcodejosh

Hi @hexcodejosh, can you provide us with an application that reproduces this issue please?

radar avatar Oct 23 '13 00:10 radar

sure, I'll create something from scratch and see if I can reproduce.

hexcodejosh avatar Oct 23 '13 01:10 hexcodejosh

Thank you!

On Wed, Oct 23, 2013 at 12:24 PM, hexcodejosh [email protected]:

sure, I'll create something from scratch and see if I can reproduce.

— Reply to this email directly or view it on GitHubhttps://github.com/spree/spree_fancy/issues/41#issuecomment-26874249 .

Ryan Bigg Community Manager Spree Commerce, Inc.

radar avatar Oct 23 '13 01:10 radar

No dice.. can't reproduce it. Here's a log of what I did in case someone else stumbles on it. I'll keep looking for some diff that triggers it.

From a fresh directory, ran following commands:

rails 4.0.0 new mystore spree install <--- note, no auto accept option used here on purpose

josh@laptop:~/spree_fancy_test$ spree install
Would you like to install the default gateways? (Recommended) (yes/no) [yes] 
Would you like to install the default authentication system? (yes/no) [yes] 
Would you like to run the migrations? (yes/no) [yes] 
Would you like to load the seed data? (yes/no) [yes] 
Would you like to load the sample data? (yes/no) [yes] no

<accepted default admin acct info>

rails server <---- works at this point

RAILS_ENV=production bundle exec rake assets:precompile <--- runs without issue

Added following to end of Gemfile:

gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '2-1-stable'

bundle install <---- ran without errors

rails server <---- works at this point

RAILS_ENV=production bundle exec rake assets:precompile <--- works at this point

However, here are the following assets that are precompiled in this step:

josh@laptop:~/spree_fancy_test$ RAILS_ENV=production bundle exec rake assets:precompile
I, [2013-10-22T20:34:47.663565 #9398]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/store/footer-bg-3161c18db91e1e36d35542fac0c732f4.png
I, [2013-10-22T20:34:47.677690 #9398]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/store/logo-white-e4166f432687acb91a55428721980a8c.png
I, [2013-10-22T20:34:47.810579 #9398]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/store/logo-white-016a99ac9665dc941252364a5e3dc51f.svg
I, [2013-10-22T20:34:47.825912 #9398]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/store/logo-e169734ca1076c2b619d02d85346e467.png
I, [2013-10-22T20:34:47.841619 #9398]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/store/subheader-bg-56e4af77f628bd507bfc2489b832abe6.png
I, [2013-10-22T20:34:47.878007 #9398]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/store/print-3492f001aa3e8f26e0d4e9f8a49561ff.css

Its missing some of the assets, such as bx_loader.gif, icons.*, as I describe in issue: https://github.com/spree/spree_fancy/issues/61

If I made that proposed fix and re-run the precompile, I get a boatload of prints, and the following assets are also compiled:

I, [2013-10-22T20:40:52.806913 #9605]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/icons-0eacfdc0140a09ed259fdaab239753a9.eot
I, [2013-10-22T20:40:52.943825 #9605]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/icons-8d3b9cfc3d91cee4fcab76cf0fe2c93c.svg
I, [2013-10-22T20:40:52.960262 #9605]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/icons-15eb6673a79fd651f411a7674cb24dae.ttf
I, [2013-10-22T20:40:52.977253 #9605]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/icons-9906b992f8f682fd4e11cc914c4b31ee.woff
I, [2013-10-22T20:40:52.993716 #9605]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/images/bx_loader-b7191bec2f9468eec52b9800bffd892c.gif
I, [2013-10-22T20:40:53.010199 #9605]  INFO -- : Writing /home/josh/spree_fancy_test/public/assets/images/controls-2a5c9523880879564e597509f280fea3.png

Hrmmmmm... it's working. How did I break my other working copy....? Have been gradually pulling in changes from my broken tree. So far, my Gemfiles are now identical, and looks like:

source 'https://rubygems.org'

ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
gem 'pg'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

gem 'compass'
gem 'compass-rails'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

gem 'asset_sync'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

gem 'spree', '2.1.1'
gem 'spree_gateway', :git => 'https://github.com/spree/spree_gateway.git', :branch => '2-1-stable'
gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-1-stable'
gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '2-1-stable'
gem 'spree_paypal_express', :github => "radar/better_spree_paypal_express", :branch => "2-1-stable"
gem 'rails_12factor', group: :production

This also compiles.

Hrmmmm.... not sure how this happened.

hexcodejosh avatar Oct 23 '13 02:10 hexcodejosh

Ah, I'm a victim of my own enthusiasm. If I modify my Gemfile to pull a tag from my fork of spree_fancy, I can reproduce it.

#gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '2-1-stable' gem 'spree_fancy', :github => 'hexcodejosh/spree_fancy', :tag => 'add_missing_assets'

So I think my proposed fix to https://github.com/spree/spree_fancy/issues/61 is too aggressive and must be pulling in some files that it shouldn't. Guessing they're then getting precompiled directly, rather than being imported as they would normally...? I'll comment out the loop in that fix and see if this issue goes away.

hexcodejosh avatar Oct 23 '13 02:10 hexcodejosh

So this fixed my issue: https://github.com/hexcodejosh/spree_fancy/releases/tag/better_fix_for_missing_assets

hexcodejosh avatar Oct 23 '13 02:10 hexcodejosh

I still have the same issue with spree_fancy 2-0-stable.

rake aborted! Undefined variable: "$c_green".

Dwarf8 avatar Oct 28 '13 11:10 Dwarf8

I was getting "File to import not found or unreadable: store/variables_override." when i try to deploy spree fancy with capistrano. It was working fine in development.

My gemfile: gem 'rails', '4.0.0' gem 'spree', github: 'spree/spree', branch: '2-1-stable' gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-1-stable' gem 'spree_gateway', github: 'spree/spree_gateway' gem 'spree_fancy', :github => 'spree/spree_fancy', :branch => '2-1-stable'

But now it broke my development environment when I tried putting gem 'compass' and gem 'compass-rails' in my gemfile and deleting lock, then running bundle install. Now In development i see:

bundler/gems/spree-366514f5036e/frontend/app/views/spree/shared/_head.html.erb

File to import not found or unreadable: store/variables_override. Load paths: CompassRails::SpriteImporter

I've removed the compass gems and then deleted the lock file and did a bundle install again but my development is still broken

jgrannas avatar Dec 12 '13 17:12 jgrannas

The same issue is reproducible in 2-2-stable only in production mode; occurs during rake assets:precompile . Trace: http://pastie.org/9161717

Gemfile:
source 'http://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'

# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
# Using postgresql
gem 'pg' # also manually install packages(ubuntu): postgresql, postgresql-server-dev-all

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

group :production do
 gem 'therubyracer'
 gem 'unicorn'
end

gem 'spree', github: 'spree/spree', branch: '2-2-stable'
gem 'spree_gateway', :git => 'http://github.com/spree/spree_gateway.git', :branch => '2-2-stable'
gem 'spree_auth_devise', :git => 'http://github.com/spree/spree_auth_devise.git', :branch => '2-2-stable'
gem 'daemon_controller'

gem 'spree_fancy', :git => 'git://github.com/spree/spree_fancy.git', :branch => '2-2-stable'

group :development do
  gem 'capistrano'
  gem 'rvm-capistrano'
  gem 'rename'
  gem 'mailcatcher'
  gem 'xray-rails'
end

vedant1811 avatar May 13 '14 17:05 vedant1811

Does anyone know how to solve this?

vike27 avatar Jun 30 '14 12:06 vike27

It seems to be fixed on the latest spree 2.2

On Mon, Jun 30, 2014 at 6:13 PM, vike27 [email protected] wrote:

Does anyone know how to solve this?

— Reply to this email directly or view it on GitHub https://github.com/spree/spree_fancy/issues/41#issuecomment-47526642.

vedant1811 avatar Jun 30 '14 13:06 vedant1811

I am on spree 2-2 stable and running into this issue in production as well... Been a week and can't fix it...

vike27 avatar Jul 04 '14 19:07 vike27

Hi @vike27, do you have an app that I can clone and reproduce this issue in? That would help me be able to debug it.

radar avatar Jul 07 '14 01:07 radar

The issue happens with this application: https://github.com/vike27/surplusmerchant2

I'll be working on it this weekend, was going to try and use 2-1 stable. Let me know if you can figure it out that way I won't have to go through that. Thanks!

Javier

On Sun, Jul 6, 2014 at 6:11 PM, Ryan Bigg [email protected] wrote:

Hi @vike27 https://github.com/vike27, do you have an app that I can clone and reproduce this issue in? That would help me be able to debug it.

— Reply to this email directly or view it on GitHub https://github.com/spree/spree_fancy/issues/41#issuecomment-48133383.

vike27 avatar Jul 07 '14 02:07 vike27

Good news! I figured that out: http://stackoverflow.com/questions/24500192/rake-aborted-sasssyntaxerror-undefined-variable-c-blue/24713907#24713907 Thank you @vike27 for your example!

flash-gordon avatar Jul 12 '14 14:07 flash-gordon