What are the advantages and disadvantages of centralizing scripts on a separate "scripts server" for multiple websites?

Centralizing scripts on a separate "scripts server" for multiple websites can help streamline maintenance and updates, reduce redundancy, and improve security by having a single source for scripts. However, it may introduce dependencies and potential downtime if the scripts server goes down.

// Example PHP code snippet for centralizing scripts on a separate server

define('SCRIPTS_SERVER_URL', 'https://example.com/scripts/');

function include_external_script($script_name) {
    $script_url = SCRIPTS_SERVER_URL . $script_name;
    echo '<script src="' . $script_url . '"></script>';
}

// Example usage
include_external_script('jquery.min.js');
include_external_script('custom-script.js');