public function defer_scripts($tag, $handle)
    {
        $excludes = Config::get('theme.defer_scripts_skip');

        // Get the script handles to exclude.
        if (empty($excludes)) {
            $exclude_list = [];
        } else {
            $exclude_list = $excludes;
        }

        // If the defer_scripts_skip option was not present, or was incompatible.
        if (! \is_array($exclude_list)) {
            $exclude_list = [];
        }

        if (\in_array($handle, $exclude_list)) {
            return $tag;
        }

        return \str_replace(' src', ' defer="defer" src', $tag);
    }
public function defer_scripts($tag, $handle)
    {
        $excludes = Config::get('theme.defer_scripts_skip');

        // Get the script handles to exclude.
        if (empty($excludes)) {
            $exclude_list = [];
        } else {
            $exclude_list = $excludes;
        }

        // If the defer_scripts_skip option was not present, or was incompatible.
        if (! \is_array($exclude_list)) {
            $exclude_list = [];
        }

        if (\in_array($handle, $exclude_list)) {
            return $tag;
        }

        return \str_replace(' src', ' defer="defer" src', $tag);
    }
public function defer_scripts ( $ tag , $ handle ) { $ excludes = Config :: get ( 'theme.defer_scripts_skip' ) ; // Get the script handles to exclude. if ( empty ( $ excludes ) ) { $ exclude_list = [ ] ; } else { $ exclude_list = $ excludes ; } // If the defer_scripts_skip option was not present, or was incompatible. if ( ! \ is_array ( $ exclude_list ) ) { $ exclude_list = [ ] ; } if ( \ in_array ( $ handle , $ exclude_list ) ) { return $ tag ; } return \ str_replace ( ' src' , ' defer="defer" src' , $ tag ) ; }
If enabled, adds defer attribute to js scripts.

@since 1.0.0

@param string $tag    HTML of current script.
@param string $handle Handle of current script.
@return string HTML output for this script.
If enabled adds defer attribute to js scripts .