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
Comment #1
tsi CreditAttribution: tsi commentedAs 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')),
Comment #2
tsi CreditAttribution: tsi commentedThe SASS branch of 965 has a new home and is now called Sasson.
Comment #3
ssherriff CreditAttribution: ssherriff commentedNo, 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.
Comment #4
ssherriff CreditAttribution: ssherriff commentedSorry, 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?
Comment #5
tsi CreditAttribution: tsi commentedWe'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.
Comment #6
tsi CreditAttribution: tsi commentedComment #7
stevetweeddale CreditAttribution: stevetweeddale commentedMy understanding is that the image path is used pretty much whenever you want to reference an image from sass. A couple of examples:
image-url('my_image.jpg');
rather than absolute path withurl()
(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)image-height('my_image.jpg')
Comment #8
tsi CreditAttribution: tsi commentedShould go in after some testing.
Comment #9
tsi CreditAttribution: tsi commentedAfter 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.
Comment #11
tsi CreditAttribution: tsi commentedUPDATE: Sasson now supports
image-url(..)
,font-url(..)
andstylesheet-url(..)
, check out the dev branch (should be updated in the next 24h).