I tried using a compass mixin called inline-image which enables automatically compiling images into base64 and including them in the css file directly. 'inline-image' looks at the compass base image directory setting which looks like it is picking up as '/images'. Basically, it isn't looking into the themes, it is just at the base drupal path.

I tried messing around with it, but I think it is hard to determine exactly which theme is being shown when running the compile. At the moment I've set it like this:

$parser = new SassParser(array(
'style' => $style,
'cache' => FALSE,
'syntax' => $syntax,
'load_paths' => $paths, // fix by http://code.google.com/p/phamlp/issues/detail?id=108
'debug_info' => $devel,
'extensions' => array('compass' => array('images_path'=> drupal_get_path('theme', 'my_theme') . '/images')),

Just wondering if setting the compass paths is actually possible or if it is not possible to pick up what that shown theme actually is. Or, maybe I'm doing something wrong and images should be getting picked up correctly.

Cheers

Comments

tsi’s picture

Project: Sasson » 965
Version: 7.x-2.x-dev » 7.x-2.0-beta6

As I understand that, the default path is the root of your project.
You can probably set it to :
'extensions' => array('compass' => array('images_path'=> drupal_get_path('theme', $default_theme) . '/images')),
And it should pick your default enabled theme, but I havn't tested it.
I wonder if we should put that in or leave it as is...

[EDIT] Even better line :
'extensions' => array('compass' => array('images_path'=> $default_theme_path . '/images')),

tsi’s picture

Project: 965 » Sasson
Version: 7.x-2.0-beta6 » 7.x-2.x-dev

The SASS branch of 965 has a new home and is now called Sasson.

ssherriff’s picture

No, that doesn't work, says that $default_theme is undefined.

I'm not sure, maybe it does make sense to leave it at the root of the project, but at the same time, most of the external files you might use compass for would actually belong to the theme.

This doesn't just happen with images, but also with font_path, etc.

I'm not sure what the best solution is though.

ssherriff’s picture

Sorry, my fault, hadn't updated to Sasson yet. That seems to work. Maybe set it to that by default but allow overriding it? Or, don't set it and somehow allow setting it in theme settings?

tsi’s picture

Project: 965 » Sasson
Version: 7.x-2.0-beta6 » 7.x-2.x-dev

We're planning on implementing this, but we need to understand the subject better.
This path is used for building image sprites and compiling images into base64, right ? are these the only uses for it ? should it be a specific image directory or something more generic like all enabled themes ?
If someone can shed more light on the subject and how is best to implement this, it would be great.

tsi’s picture

Status: Active » Postponed (maintainer needs more info)
stevetweeddale’s picture

My understanding is that the image path is used pretty much whenever you want to reference an image from sass. A couple of examples:

  • Setting a background image with image-url('my_image.jpg'); rather than absolute path with url()(meaning you can re-structure your theme and where the images live without issue, and you'd get cache-busting querystings appended to the url too)
  • Using image attributes in your sass, such as with image-height('my_image.jpg')
tsi’s picture

Status: Postponed (maintainer needs more info) » Needs work

Should go in after some testing.

tsi’s picture

Status: Needs work » Fixed

After long time, I finally found the opportunity to actually use image-url('my_image.jpg'); in a real-life project.
So this just got committed to 2.3. please test and share your experience.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

tsi’s picture

Status: Closed (fixed) » Fixed

UPDATE: Sasson now supports image-url(..), font-url(..) and stylesheet-url(..), check out the dev branch (should be updated in the next 24h).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 8f9a384 on 7.x-2.x, compasscompile, 7.x-3.x, PHPSass, 7.x-3.x-Assetic, 7.x-3.x-susy by tsi:
    Issue #1367502 by ssherriff : Set compass image path; Issue #1645280 by...