Sprite images are not being generated but css is generated correctly. #6

Closed
k2052 opened this Issue Aug 23, 2010 · 9 comments

Projects

None yet

7 participants

@k2052

I'm using Lemonade inside a Padrino app along with Compass/Sass. Lemonade creates the css just fine and doesn't produce any errors, but for some reason doesn't save or generate the actual sprite file. The only error I get is one from Compass warning that image-url is pointing to a non-existent file, i.e

WARNING: 'xxx.png' was not found (or cannot be read) in XXX

After a quick look at Lemonade's code I gather that; Compass is supposed to call Lemonade::generate_sprites? So if the Sass extensions/functions are working correctly then Lemonade can silently fail to generate the sprite? It might be good to include some sort of Warning in the code to inform when the generate_sprites method fails.

Do you have any idea what could be causing the generation of the sprites to fail? I've tried the obvious and made sure it was using the correct paths and that it had write permissions on those paths.

I'm going over Lemonade's code now but I have zero familiarity with how Compass plugins are written so it will probably take me awhile to find a fix myself and contribute a patch.

Thanks for any help or direction you can provide.

@hagenburger
Owner

The warning is generated by Compass has no negative effect and will be prevented in the next version by generating blank files.

I guess the problem is, that Lemonade::generate_sprites has not been called. I haven’t tested Lemonade with Sinatra yet.

As of now, Sass doesn’t provide a hook which Lemonade could use to generate sprites. Currently lemonade gets into the CSS compilations at different places in the code (search for Lemonade::generate_sprites). That’s because Compass, Sass as Plugin and Sass as Engine works differently.

You could try to use the latest (development) version from source:

git clone git://github.com/hagenburger/lemonade.git
cd lemonade
gem build lemonade.gemspec
gem install lemonade-0.3.4.gem # I haven't updated the version
@tobico

I'm getting the same issue with Lemonade 0.3.4 and Rails 2.3.8

@harryhorn

I had the same issue of css being generated but no sprite image created. I am using rails 2.3.5 and compass 0.10.5, haml 3.0.18 with ruby 1.9.2. Installing the latest development version (beta 1) fixed the issue. Great gem!

@pusewicz

This still does not seem to work on newest Rails.

@lukaszkorecki

Still doesn't work:

rails 2.3.10
latest haml, sass, chunky_png and compass

@k2052

What I ended up doing is just creating a separate compass_config.rb file and then manually running compass on my stylesheets with compass -c compass_config.rb. When you run compass directly it seems to have no issues generating the sprites, it just doesn't work when as a rails plugin, padrino initializer, etc.

At least in my use case I only need the sprites generated before putting the app into production mode. So, I just generate the sprites before deploying in my deployment rake task.

@hagenburger
Owner

It’s not working with the latest chunky_png version. Please use an older version via Gemfile. Be sure to run bundle exec compass watch and add this at the beginning of your compass.rb:

require "bundler"
Bundler.setup

I recommend to use Compass Sprites as Lemonade continues its life as part of Compass and will be developed and maintained there. Please have a look at the Compass Sprites documentation.

@mkhattab

The problem has to do with the latest chunky_png version as hagenburger mentioned. You can solve this problem by entering this into your config.rb file at the very top:

gem 'chunky_png', '=0.12.0'
require 'lemonade'

This specifically requests the chunky_png version that makes lemonade work again

@hagenburger
Owner

I’m closing this because of some deprecation.

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