postcss / postcss-url

PostCSS plugin to rebase url(), inline or copy asset.
MIT License
377 stars 59 forks source link

multiple options : inline -> copy #113

Closed digitalkaoz closed 6 years ago

digitalkaoz commented 6 years ago

hey, i have the following config:

[{
            url: "inline",
            maxSize: 7,
            optimizeSvgEncode: true
}, {
            url: "copy",
            assetsPath: "dist/",
            shrink: 8,
            useHash: true
}]

i would expect this plugins tries inline first, and falls through to copy if the size is bigger than 7KB. but it doenst seem to work this way...how can it be solved (with custom options to copy)?

sergcen commented 6 years ago

HI @digitalkaoz I think you're right, this should to work as you say 👍 . I will implement this feature in 8.xx release But now, you can extend inline options by copy options

{
            url: 'inline',
            maxSize: 7,
            optimizeSvgEncode: true,
            // fallback options
            fallback: 'copy',
            assetsPath: "dist/",
            shrink: 8,
            useHash: true
}
digitalkaoz commented 6 years ago

yap that worked! thanks