Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

url functions no longer respect paths after a recompile #989

Closed
krisbulman opened this issue Aug 13, 2012 · 24 comments
Closed

url functions no longer respect paths after a recompile #989

krisbulman opened this issue Aug 13, 2012 · 24 comments

Comments

@krisbulman
Copy link

OS X 10.7.3
Ruby 1.9.3p125
Sass 3.2.0 (Media Mark)
Compass 0.13.alpha.0 (Markab)

Using relative_assets, image-url() and font-url() only pass the right path after a clean compile, and any subsequent manual compile produces only a filename with no path. This bug has been around since 3.2 alpha 275 of Sass this commit.

example:

background: url("../../images/grid-col-numbers.png?1343702520") no-repeat scroll 0 0px;

modifying any file in the project, then just running compass compile changes the path to a wrong one:

background: url("grid-col-numbers.png?1343702520") no-repeat scroll 0 0px;

config.rb

images_dir      = "images"
relative_assets = true;

EDIT: updated with sample project details:

I've created a sample project that shows the problem:

git clone git://github.com/krisbulman/compass-image-url-example.git

http://github.com/krisbulman/compass-image-url-example

Steps to reproduce:

  1. compass compile (css dir and stylesheet gets created, image path ok in style.css)
  2. edit _mixins.scss but make no code changes
  3. compass compile (check style.css, image path borked)

EDIT: updated with debugging details and commit

debugging: https://gist.github.com/4d16fdbe950ecbe582de
slight progress: #1062

@chriseppstein
Copy link
Member

Seems likely that you've got compilation happening twice and it's misconfigured in one of them.

Hunt & pecked on my iPhone... Sorry if it's brief!

On Aug 12, 2012, at 8:11 PM, Kris Bulman notifications@github.com wrote:

OS X 10.7.3
ruby 1.9.3p125
Sass 3.2.0 (Media Mark)
Compass 0.13.alpha.0 (Markab)

Using relative_assets, image_url('image.png') only passes the right path some of the time.

compass clean then compass compile, produces the right path

example:

background: url("../../images/grid-col-numbers.png?1343702520") no-repeat scroll 0 0px;
modifying any file in the project, then just running compass compile changes the path to a wrong one:

background: url("grid-col-numbers.png?1343702520") no-repeat scroll 0 0px;
config.rb

images_dir = "images"
relative_assets = true;

Reply to this email directly or view it on GitHub.

@krisbulman
Copy link
Author

I did forget to mention I am using image-url in a loop, and passing the results as a list.

I've created a sample project that shows the problem:

git clone git://github.com/krisbulman/compass-image-url-example.git

http://github.com/krisbulman/compass-image-url-example

Steps to reproduce:

  1. compass compile (css dir and stylesheet gets created, image path ok in style.css)
  2. edit _mixins.scss but make no code changes
  3. compass compile (check style.css, image path borked)

@krisbulman
Copy link
Author

Can anyone else reproduce this?

@chriseppstein
Copy link
Member

I can reproduce it. Very strange :(

@MoOx
Copy link
Contributor

MoOx commented Aug 14, 2012

I don't know if it's the same problem, but I've got a weird issue similar (yesterday and today) with font-url(), which, with the same "instance" of compass watch first use the correct fonts_dir, then, later, use a absolute path. Really weird. I've to stop compass watch, then relaunch it and save a file to have to correct font-url() back.

@krisbulman
Copy link
Author

I can confirm the same happens with font-url(), I have updated the sample project to show the problem, follow the same steps to reproduce. I haven't included a font because it's unnecessary.

@krisbulman
Copy link
Author

This problem persists when rolling back compass versions (tried back to 12.1), so I started rolling back sass releases to determine when the bug was introduced.

The bug was introduced in 3.2.0.alpha.277 released on July 27, 2012.
Rolling back to 3.2.0.alpha.275 released on July 16, 2012 fixes the problem.

For others who need this to work, use alpha 275 for now:

sudo gem install sass -v 3.2.0.alpha.275

UPDATE:

commit that this stops working on stable is: sass/sass@daf44b6 (merge conflict)
last commit I can get to work for Sass on the stable branch is sass/sass@2798d48

Should this be a Sass bug report?

@chriseppstein
Copy link
Member

Good sleuthing, this will help me debug the issue. I'm not sure who's bug this is, so let's just leave it here for now until I diagnose it.

@idflood
Copy link

idflood commented Aug 22, 2012

I stumbled on this bug when I wanted to try zurb foundation today. Uninstalling sass 3.2.x told me
zurb-foundation-3.0.9 depends on [sass (>= 3.2.0)]

@krisbulman
Copy link
Author

@idflood If you're looking to roll back to the working alpha version that doesn't produce this problem, first install the alpha 275 version:

sudo gem install sass -v 3.2.0.alpha.275

then uninstall 3.2 and it won't give you that warning:

sudo gem uninstall sass

(choose the sass version that is not 275alpha)

Note: I have just confirmed this bug also persists in 3.2.1

@teppeis
Copy link

teppeis commented Sep 4, 2012

I have this same problem in sass-3.2.1 and compass-0.12.2.

@smt
Copy link

smt commented Sep 6, 2012

Confirmed with sass-3.2.1 and compass-0.12.2

@chrisvanpatten
Copy link

Another confirmation with sass-3.2.1 and compass-0.12.2. I'm also using guard-compass (my own patch), although I'm getting the problem when not using it as well.

@krisbulman
Copy link
Author

OK, I did much more sleuthing on this problem. The commit that I mentioned stopped working earlier was a merge of two branches. I followed the other branch back and determined that this is the commit that creates the problem.

sass/sass@e36aedc

The parent commit works: sass/sass@0db3cb6

@krisbulman
Copy link
Author

I did a bit of debugging around this, and documented it here:

https://gist.github.com/4d16fdbe950ecbe582de

If anyone who is familiar with ruby/ruby debugging can point me on a fruitful path, I'd be grateful.

@krisbulman
Copy link
Author

That commit actually seems to solve the problem, and all debugging in the previous comment now report properly on second compile. What I'm not completely sure of is why it actually solves the problem, but I hope it's on the right path! I got the idea from the :filename string replacement in the new sass tests from the commit that caused this problem in the first place.

@scottdavis
Copy link
Member

@scottdavis
Copy link
Member

@scottdavis
Copy link
Member

Which is set here: https://github.com/chriseppstein/compass/blob/master/lib/compass/compiler.rb#L161

But dumping out the value always shows it set in both cases? where is it getting removed? Possibly something is not getting duped?

@scottdavis
Copy link
Member

When you dump the sass options on a _mixin.scss change there is not css_filename set

{:style=>:expanded, :load_paths=>[/Volumes/SSD/Work/compass-image-url-example/sass, /Volumes/SSD/Work/compass/frameworks/blueprint/stylesheets, /Volumes/SSD/Work/compass/frameworks/compass/stylesheets, /Users/sdavis/.compass/extensions/testing/stylesheets, Compass::SpriteImporter], 
:cache=>true, :cache_location=>"/Volumes/SSD/Work/compass-image-url-example/.sass-cache", :syntax=>:scss, :filesystem_importer=>Sass::Importers::Filesystem, :cache_store=>#{:sha=>"08f2e2e5b03e6335e8f70d38f7778867c5aec147", :obj=>(Sass::Tree::RootNode Sass::Tree::ImportNode (Sass::Tree::RuleNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::MixinNode) Sass::Tree::MixinNode)}, "c1ef5c9f97d8281df6465a6e757ee57af51e322c/_mixins.scssc"=>{:sha=>"433d307191c4c22cd423d45da437c99fc3df6ce0", :obj=>(Sass::Tree::RootNode Sass::Tree::VariableNode Sass::Tree::VariableNode Sass::Tree::VariableNode Sass::Tree::CommentNode (Sass::Tree::FunctionNode Sass::Tree::ReturnNode) (Sass::Tree::RuleNode Sass::Tree::PropNode) Sass::Tree::CommentNode (Sass::Tree::MixinDefNode Sass::Tree::VariableNode Sass::Tree::VariableNode Sass::Tree::VariableNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::CommentNode Sass::Tree::VariableNode (Sass::Tree::ForNode Sass::Tree::VariableNode Sass::Tree::VariableNode Sass::Tree::VariableNode) Sass::Tree::PropNode) Sass::Tree::CommentNode (Sass::Tree::MixinDefNode (Sass::Tree::DirectiveNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::PropNode)))}}>, #]>, 
:line_comments=>true, :importer=>/Volumes/SSD/Work/compass-image-url-example/sass, :compass=>{:logger=>#, :environment=>:development}, :filename=>"/Volumes/SSD/Work/compass-image-url-example/sass/_mixins.scss", :original_filename=>"/Volumes/SSD/Work/compass-image-url-example/sass/style.scss", :property_syntax=>nil}

@scottdavis
Copy link
Member

But it is when you change the top level file.

{:style=>:expanded, :load_paths=>[/Volumes/SSD/Work/compass-image-url-example/sass, /Volumes/SSD/Work/compass/frameworks/blueprint/stylesheets, /Volumes/SSD/Work/compass/frameworks/compass/stylesheets, /Users/sdavis/.compass/extensions/testing/stylesheets, Compass::SpriteImporter], :cache=>true, :cache_location=>"/Volumes/SSD/Work/compass-image-url-example/.sass-cache", :syntax=>:scss, :filesystem_importer=>Sass::Importers::Filesystem, :cache_store=>#{:sha=>"f5597d0e6e0f7f82c7e4c52780d70130c3d28ea4", :obj=>(Sass::Tree::RootNode Sass::Tree::ImportNode (Sass::Tree::RuleNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::MixinNode) (Sass::Tree::RuleNode Sass::Tree::PropNode) Sass::Tree::MixinNode)}, "c1ef5c9f97d8281df6465a6e757ee57af51e322c/_mixins.scssc"=>{:sha=>"433d307191c4c22cd423d45da437c99fc3df6ce0", :obj=>(Sass::Tree::RootNode Sass::Tree::VariableNode Sass::Tree::VariableNode Sass::Tree::VariableNode Sass::Tree::CommentNode (Sass::Tree::FunctionNode Sass::Tree::ReturnNode) (Sass::Tree::RuleNode Sass::Tree::PropNode) Sass::Tree::CommentNode (Sass::Tree::MixinDefNode Sass::Tree::VariableNode Sass::Tree::VariableNode Sass::Tree::VariableNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::CommentNode Sass::Tree::VariableNode (Sass::Tree::ForNode Sass::Tree::VariableNode Sass::Tree::VariableNode Sass::Tree::VariableNode) Sass::Tree::PropNode) Sass::Tree::CommentNode (Sass::Tree::MixinDefNode (Sass::Tree::DirectiveNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::PropNode Sass::Tree::PropNode)))}}>, #]>, :line_comments=>true, :importer=>/Volumes/SSD/Work/compass-image-url-example/sass, :compass=>{:logger=>#, :environment=>:development}, :filename=>"/Volumes/SSD/Work/compass-image-url-example/sass/_mixins.scss", :css_filename=>"/Volumes/SSD/Work/compass-image-url-example/css/style.css", :original_filename=>"/Volumes/SSD/Work/compass-image-url-example/sass/style.scss", :property_syntax=>nil}

@scottdavis
Copy link
Member

Could it be because the options became read only?
sass/sass@e36aedc#L1L21

@chriseppstein
Copy link
Member

Fixed in Sass.

@krisbulman
Copy link
Author

Amazing! see @nex3's fix here sass/sass#412

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

No branches or pull requests

8 participants