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

Should Asset Helpers Work With Digests? #9

Closed
metaskills opened this issue Nov 14, 2011 · 7 comments
Closed

Should Asset Helpers Work With Digests? #9

metaskills opened this issue Nov 14, 2011 · 7 comments

Comments

@metaskills
Copy link
Owner

Spawed from ticket #3 which mentioned that given this.

.myimage() {
  background-image: image-url("less_framework/less.png");
}
#container {
  .myimage();
}

Compiles with rake assets:precompile to this content #container{background-image:url(/assets/less_framework/less.png);}. The question is should there be a digest in that asset url? Here is what is output to the assets directory.

  • less_framework/less-ef9b99c1df7d13853cb626bdf3f1f269.png
  • less_framework/less.png

Will need to look at sass-rails and see if it does this too. Feedback appreciated.

@cowboyd
Copy link
Collaborator

cowboyd commented Nov 14, 2011

I'm not sure I'm grasping the problem:

we have in shared less lib (brought in via @import) the following definition to add background noise to an element:

.noisy() {
  background-image: image-url("bg-noise.jpg");
}

this noisy class is on the body tag:

body {
  color: #849bA0;
  background-color: @background-gray;
  .noisy;
}

which results in the following line in the rendered file application-26c81a0f126d46f5968064dc0f38123a.css

body {
  color: #849bA0;
  background-color: #3d4646;
  background-image: url(/assets/bg-noise-c7bdb4476407313f26fbcc702e77dee8.jpg);
}

Is this not what you're seeing in your environment?

@metaskills
Copy link
Owner Author

Wow, no I am not! I was just about to post this on my same test projects sass too which means it has to be something on my end. Odd.

Sass does the same thing as we do. Is this a configuration failure on my end or does anything that implements asset helpers for sprocket care about this? Perhaps a rails or sprockets issue? My tests below.

I hav an image in vendor/assets/images/sass_framework/sass.png. I then have this file in vendor/assets/stylesheets/sass_framework/base.css.scss

@mixin myimage() {
  background-image: image-url("sass_framework/sass.png");
}

I then have my application.css setup like so.

/*
 *= require site/sass
 *= require_self
*/

And my app/assets/site/sass.css.scss setup like so.

@import 'sass_framework/base';

#container {
  @include myimage;
}

This outputs the following in application.css.

#container{background-image:url(/assets/sass_framework/sass.png);}

@metaskills
Copy link
Owner Author

OH, I GET IT! The digests are included in the generated CSS that also has a digest. Brilliant! Closing this ticket.

@stouset
Copy link

stouset commented Nov 14, 2011

So... you're not going to fix this?

@metaskills
Copy link
Owner Author

There is nothing to fix.

@metaskills
Copy link
Owner Author

We are working just like sass/rails wants us too. Seems they only put the digest urls in the digest content. As @cowboyd pointed out and it took me awhile to notice/learn.

@stouset
Copy link

stouset commented Nov 14, 2011

Oh, yep. I see it too. Tricky.

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

No branches or pull requests

3 participants