Morning Pascal,
Did some tests with that code, bringing it to the essenstial;
class WordPressBoilerplate{
static $ver = '2.0.0';
function __construct(){
add_action( 'wp_enqueue_scripts', array(__CLASS__, 'FrontendScripts') );
}
public static function FrontendScripts(){
wp_enqueue_script( 'jquery' );
wp_register_script('wp-h5bp-plugins', get_stylesheet_directory_uri().'/js/plugins.js', array('jquery'), self::$ver, true);
wp_register_script('wp-h5bp-main', get_stylesheet_directory_uri().'/js/main.js', array('jquery', 'wp-h5bp-plugins'), self::$ver, true);
wp_enqueue_script('wp-h5bp-plugins');
wp_enqueue_script('wp-h5bp-main');
}
}
$WordPressBoilerplate = new WordPressBoilerplate();
I have no problem getting this to work both with and without Autoptimize.
Maybe stating the obvious, but do take into account that you won't actually see the seperate JS-files being called when AO is active, as AO will aggregate all JS-files into one minified "autoptimize_xyz.js"-file?
Have a nice sunday!
frank