Closed KATT closed 10 years ago
What happens now? url(...)
passes straight through into your compiled CSS? Or it's replaced with an incorrect value?
This is not something I've attempted to use myself. Perhaps you can provide a small test case to play with?
Secondly, I'd like not having to include the relative path of images when using url()
. I.e. background-image: url('logo.png');
rather than background-image: url('../images/logo.png');
. Is there a way of enabling this behaviour?
@es128, it simply outputs the path as I declared in the url()
, as is. I'll make an example, hold on.
Made a repo you can play with @es128
https://github.com/KATT/stylus-brunch-issues-29
Clone and launch brunch w -s
as usual to test it.
I've found a solution that appears to work without modifying the plugin. To the top of your brunch config add
stylus = require './node_modules/stylus-brunch/node_modules/stylus'
And add defines
to your stylus plugin config:
stylus:
defines:
url: stylus.url()
paths: [
'./app/assets/images'
]
The path could also be passed to the stylus.url()
function, but this way appears to work and seems cleaner.
Arguably it would be better to bake an option in to the plugin in the future to enable this more easily than doing that clunky require statement.
Great! Thanks @es128, now it's just the secondary issue that's bothering me :)
@KATT I don't see where the jade docs say they'll do that for you (enter the full path for images >30kb). You may want to open an issue with the jade project to request that as a feature.
Trying to use Data URI Image Inlining, which enables you to include small images as inline base64 data URIs in the CSS instead of references to the image.
How can I achieve this using
stylus-brunch
? I know myplugins.stylus.paths
-setting is correct ('./app/assets/images'
) asimage-size()
works without supplying the full path. Also tried passing all different paths toplugins.stylus.url.paths
.Is it possible to achieve? Want my 4K loading spinner to be seamlessly inlined when I use
url()
.