kasparsd / minit

A WordPress plugin to combine CSS and Javascript files.
GNU General Public License v2.0
286 stars 46 forks source link

Allow filter for CDN absolute URL in CSS #70

Closed unclhos closed 8 years ago

unclhos commented 8 years ago

How can I use CDN for assets in CSS? Is it possible to filter the url without going in a modifying the urls by hand?

LQ2-apostrophe commented 8 years ago

Hello!

For this, I have written a seperate plugin as an addon. Check it here: https://github.com/LQ2-apostrophe/minit-cdn

szepeviktor commented 8 years ago

Do you mean having your pull CDN serve the minited CSS file?

You could

kasparsd commented 8 years ago

@unclhos I would probably use the minit-content-css filter (not tested):

add_filter( 'minit-content-css', function( $css ) {
    return str_replace(
        '//example.com',
        '//cdn.example.com',
        $css
    );
} );