: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
import lazySizes from 'lazysizes';
// Lazyload for background images.
const lazyloadBackground = ( element ) => {
let bgValue = element.getAttribute( 'data-bg-image' );
let property = 'background-image';
bgValue = element.getAttribute( 'data-bg' );
const importantRegex = /\s*\!\s*important/i;
const value = bgValue.replace( importantRegex, '' );
const priority = value !== bgValue ? 'important' : '';
element.style.setProperty( property, value, priority );
document.addEventListener( 'lazybeforeunveil', function( e ) {
// Lazy background image.
lazyloadBackground( e.target );