Compass / compass

Compass is no longer actively maintained. Compass is a Stylesheet Authoring Environment that makes your website design simpler to implement and easier to maintain.
http://compass-style.org
Other
6.72k stars 1.18k forks source link

Arguments to include all-[sprite]-sprites don't seem to work anymore #1600

Open Anahkiasen opened 10 years ago

Anahkiasen commented 10 years ago

On 1.0.0.alpha.19 it seems I can't do this anymore :

@include all-icon-sprites(true);

To generate the corresponding width and height of the sprites. Was this never intended to be in the public API ? I get this :

error public/app/sass/styles.scss (Line 7 of _base.scss: different prefix: "/" and "public/app/img/sprite/generated" for `sprite-file')

Removing the boolean fixes the problem. Works fine on 1.0.0.alpha.18.

georgethomasuk commented 10 years ago

I have had the same problem. Though it seemed to be specifically related to setting:

$icon-sprite-dimensions: true;

When set to false compass compiled without any trouble

pascalduez commented 10 years ago

I'm having the same error after upgrading to 1.0.0.alpha.19. Using the sprite-file($map, $sprite) function.

mm-tom commented 10 years ago

Also seeing this problem. Oddly it just suddenly started happening. Not sure if it is related to sass 3.3.3 although this occurred about 4 hours after upgrading sass so I don't think so, unless some sort of caching was preventing it occurring initially.

georgethomasuk commented 10 years ago

The issue seems to be in how the sprite_file method generates a path to the original asset, as it end up generating invalid paths.

I have tried to modifying the function to fix the issue, but my low level of Ruby and under the hood Compass knowledge, meant I couldn't find a solution without breaking something else.

georgethomasuk commented 10 years ago

Looks like the same issues as raised in #1617

pascalduez commented 10 years ago

Related #1665

chriseppstein commented 10 years ago

I'll look into it.

scottdavis commented 10 years ago

Ill look into this and #1665 tonight

chriseppstein commented 10 years ago

Honestly, I cannot reproduce this unless I misconfigure my project by setting a *_path property to a relative url instead of an absolute path.

http://compass-style.org/help/tutorials/configuration-reference/

If someone can provide a properly configured project that has this issue please post the details.

pascalduez commented 10 years ago

When I upgrade to 1.0.0.alpha.19 have this issue on this project with the following config. No issue on 1.0.0.alpha.18.

The error message:

Syntax error: different prefix: "/" and "test/img/sprites" for `sprite-file'
        on line 14 of [...]/stylesheets/icons/_icon-generated.scss, in `icon-generated'
        from line 70 of test/sass/test-icons.scss
  Use --trace for backtrace.

I don't feel like doing something wrong in *_path config. Although I have to admit it's sometimes a bit confusing...

Thanks.

Edit: I think I tried every possible combinations of config, and always get the error. Checking the sprite_file function code, there's been quite some changes between the 2 versions.

pascalduez commented 10 years ago

Related: #1659

chriseppstein commented 10 years ago

@pascalduez

Try:

generated_images_dir = "img/sprites"
pascalduez commented 10 years ago

Try: generated_images_dir = "img/sprites"

@chriseppstein Same issue with this setting...

Edit: even with a bare minimal settings I can't get ride of it:

css_dir = "test/css"
sass_dir = "test/sass"
images_dir = "test/img"

Basically, sprite-file should only care about images_dir or images_path or I'm missing something ?

chriseppstein commented 10 years ago

@pascalduez Can you make a zip (or tar.gz) file of a minimal compass project that has this problem and email it to chris@eppsteins.net?

lolmaus commented 10 years ago

Or a Github repo.

hgrimelid commented 10 years ago

I fixed the issue by setting

project_path = File.expand_path('.')

as suggest by @brewster1134 in https://github.com/chriseppstein/compass/issues/1617#issuecomment-42152050

pascalduez commented 10 years ago

Investigating: I could not reproduce the error on a bare minimal project. So I tried to trace back the differences.

It seems to comes from the compiler used, sass instead of compass: this produce the error: bundle exec sass --watch --compass test/sass:test/css while this works fine bundle exec compass watch

Repository of test project: https://github.com/pascalduez/compass-1600

U P D A T E The error can be reproduced with both sass or compass compiler. Seems to come from project_path configuration:

# No error
css_dir = "test/css"
sass_dir = "test/sass"
images_dir = "test/img"

# Error
project_path = "test"
css_dir = "css"
sass_dir = "sass"
images_dir = "img"

New error, sprite_file seems to pass a broken path to image_size

Errno::ENOENT on line ["31"] of [...]/sass_extensions/functions/image_size.rb: No such file or directory - [...]/compass-1600/test/img/../icons/social/png/facebook.png
css_dir = "test/css"
sass_dir = "test/sass"
images_dir = "test/img"
generated_images_dir = "test/img/sprites"

Repo updated.

Anahkiasen commented 10 years ago

I'm using Compass to compile and still got that error

pascalduez commented 10 years ago

I'm using Compass to compile and still got that error

Well yeah, that's what I just realized... I can get the error with compass compiler as well. Back to hunt... Will update previous comment.

chriseppstein commented 10 years ago

project_path is a path and needs to be absolute like all the other *_path options. >_<

I don't love this config system, but it's how it works.

Arcovion commented 10 years ago

@chriseppstein You could internally make the paths absolute via File#expand_path/File#absolute_path, it wouldn't affect paths that are already absolute.

Alternatively raise an error on Pathname#relative? so people immediately see where the problem lies.

pascalduez commented 10 years ago

project_path is a path and needs to be absolute like all the other *_path options. >_< I don't love this config system, but it's how it works.

Well, a few points should be noted:

Then there is the second issue: as soon as I add generated_images_dir (no project_path) https://github.com/pascalduez/compass-1600/blob/master/config.rb#L18-L22 Might be related to #1671

chriseppstein commented 10 years ago

It does make sense to resolve project_path to an absolute value. The other *_path settings should be an error if they are not set to an absolute value.