data uris not working #37

Closed
SgtK opened this Issue Sep 6, 2012 · 2 comments

Projects

None yet

2 participants

@SgtK

Hey

I'm trying to get CSS Crush to generate data uris, but perhaps I'm missing somentihg...

$css = csscrush_string("
    .mydiv {
        background: data-uri(img/img.png) no-repeat;
    }
");

echo $css;

outputs:

.mydiv {
    background: url(img/img.png) no-repeat;
}
@peteboere
Owner

You need to add a context when referencing resources in raw strings:

$css = csscrush_string("
    .mydiv {
        background: data-uri(images/thumb.jpg) no-repeat;
    }
", array( 'context' => __DIR__ ));

In this example the image will be searched for relative to the context argument.

The original url is returned when the image cannot be found.

@SgtK

Thanks :)

@peteboere peteboere closed this Sep 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment