<?php

/* Scripts and Styles */

if( !function_exists('breek_lite_enqueue_scripts') ){

    add_action('wp_enqueue_scripts', 'breek_lite_enqueue_scripts');

	function breek_lite_enqueue_scripts() {

		$assets_folder = BREEK_LITE_THEMEPATH.'/assets';
        $prefix = BREEK_LITE_THEMEPREFIX.'-';

        $theme = wp_get_theme( BREEK_LITE_THEMESLUG );
        $ver = $theme->version; 
        $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';

        /* Styles */
        
        wp_enqueue_style($prefix.'theme', $assets_folder.'/dist/style'.$suffix.'.css', NULL, $ver); // There is a style.css (unminified) file if needed
        wp_enqueue_style($prefix.'fonts', $assets_folder.'/dist/fonts.css', NULL, $ver);

        wp_enqueue_style('fontawesome', $assets_folder.'/dist/fontawesome'.$suffix.'.css', NULL, $ver);
        wp_enqueue_style('remixicons', $assets_folder.'/dist/remixicons'.$suffix.'.css', NULL, $ver);
        wp_enqueue_style('magnific-popup', $assets_folder.'/dist/plugin-magnific-popup'.$suffix.'.css', NULL, $ver); // There is a dist/plugin-magnific-popup.css (unminified) file if needed  

        /* Scripts */

        wp_enqueue_script('masonry');  // Masonry is a built-in WordPress script, so we can enqueue it without specifying a source  
        wp_enqueue_script('magnific-popup', $assets_folder.'/dist/plugin-magnific-popup'.$suffix.'.js', array('jquery'), $ver, true);            
        wp_enqueue_script('diacritics', $assets_folder.'/dist/diacritics'.$suffix.'.js', array('jquery'), $ver, true);
        wp_enqueue_script('tocbot', $assets_folder.'/dist/tocbot'.$suffix.'.js', array('jquery'), $ver, true);
        wp_enqueue_script($prefix.'functions', $assets_folder.'/dist/functions'.$suffix.'.js', array('jquery'), $ver, true);

		if( is_singular() && comments_open() && ( get_option( 'thread_comments' ) == 1) ) {
			wp_enqueue_script( 'comment-reply', 'wp-includes/js/comment-reply', array(), false, true );
        }

    }
    
}