Skip to content

antoinegreuzard/wordplate-vite.config.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

vite.config.js which works with WordPlate for better image loading

Images call in CSS and PHP

CSS

background-image: url('../static/img/test.png');

PHP

In functions.php :
function get_image_path($image): string {
    if (is_array(wp_remote_get('http://localhost:5173/'))) {
        $hrefImages = "http://localhost:5173/resources/static/img/$image";
    } else {
        $hrefImages = get_theme_file_uri("assets/img/$image");
    }
return $hrefImages;

}


In template.php :
get_image_path('test.png');

About

vite.config.js which works with WordPlate for better image loading

Topics

Resources

Stars

Watchers

Forks