Last active
January 3, 2022 08:58
-
-
Save krasenslavov/9f782db55e6c567dc953f760226f6e3d to your computer and use it in GitHub Desktop.
How to Setup JS and CSS Environment Files (no external libraries)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('DEV_MODE', true); | |
add_action('wp_enqueue_scripts', function() { | |
if (DEV_MODE) { | |
wp_register_script('unique_name', get_template_directory_uri() . 'assets/js/init.js', array('jquery'), '1.0', true); | |
wp_register_style('unique_name', get_template_directory_uri() . 'assets/css/uuid.css', array(), '1.0', 'all'); | |
} else { | |
wp_register_script('unique_name', get_template_directory_uri() . 'build/js/uuid.min.js', array('jquery'), '1.0', true); | |
wp_register_style('unique_name', get_template_directory_uri() . 'build/css/uuid.min.css', array(), '1.0', 'all'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment