Skip to content

Commit 02cc920

Browse files
committed
Customizer: library lazyload
1 parent 3dbf79f commit 02cc920

File tree

8 files changed

+11
-20
lines changed

8 files changed

+11
-20
lines changed

inc/admin/customizer.php

-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ function stormbringer_customize_register( $wp_customize ) {
105105
if(current_theme_supports('libraries')) :
106106
$libraries = get_theme_support('libraries')[0];
107107

108-
print_r($libraries);
109108
foreach($libraries as $librarie_name => $librarie_key) :
110109
$wp_customize->add_setting(
111110
'libraries_'.$librarie_name.'',
@@ -216,7 +215,6 @@ function stormbringer_customize_register( $wp_customize ) {
216215
) );
217216

218217
// Preprocessor
219-
220218
$wp_customize->add_setting('bootstrap_preprocessor', ['default' => 'scss']);
221219
$wp_customize->add_control('bootstrap_preprocessor', array(
222220
'label' => __('Preprocessor', 'stormbringer'),

inc/front/scripts.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ function stormbringer_js_theme() {
1010
// Preprocessor
1111
$preprocessor = get_theme_mod('bootstrap_preprocessor', true);
1212

13-
if ( $preprocessor == 'less' ) {
13+
if ( $preprocessor === 'less' ) {
1414
wp_enqueue_script( 'application.js', get_stylesheet_directory_uri() . '/js/application.js', array( 'jquery' ), null, true );
1515
}
1616

17-
if ( $preprocessor == 'scss' ) {
17+
if ( $preprocessor === 'scss' || $preprocessor == 1) {
1818

1919
$grunt_assets = get_theme_mod('grunt_assets');
2020

inc/front/styles.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function stormbringer_preprocessor() {
77

88
$cssfile = 'css/application.css';
99

10-
if ( $preprocessor == 'less' ) {
10+
if ( $preprocessor === 'less' ) {
1111
if ( ! is_admin() ) {
1212
// less.js for admin (development only)
1313
//if ( current_user_can('administrator') && (ENVIRONMENT == "dev" || ENVIRONMENT == "local")) {
@@ -28,7 +28,7 @@ function stormbringer_preprocessor() {
2828
}
2929
}
3030

31-
if ( $preprocessor == 'scss' ) {
31+
if ( $preprocessor === 'scss' || $preprocessor == 1) {
3232

3333
if ( ! is_admin() ) {
3434
if ( current_user_can( 'administrator' ) || $_GET['scsscompile'] == '1' ) {
@@ -71,6 +71,12 @@ function stormbringer_css() {
7171
wp_register_style( 'bootstrap-select', '//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/'.$libraries['bootstrap-select'].'/css/bootstrap-select.min.css', array(), null, 'screen,projection' );
7272
wp_enqueue_style( 'bootstrap-select' );
7373
}
74+
75+
if(@$libraries['bootstrap-datepicker'] && get_theme_mod('libraries_bootstrap-datepicker', true)){
76+
wp_register_style( 'bootstrap-datepicker', '//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/'.$libraries['bootstrap-datepicker'].'/css/bootstrap-datepicker.min.css', array(), null, 'screen,projection' );
77+
wp_enqueue_style( 'bootstrap-datepicker' );
78+
}
79+
7480
}
7581

7682
}

inc/init.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function stormbringer_support() {
3737

3838
locate_template( 'inc/front/shortcodes.php', true ); // Shortcodes for Bootstrap: alert, badge, label, button, gallery
3939
$preprocessor = get_theme_mod('bootstrap_preprocessor', true);
40-
if($preprocessor == 'less'){
40+
if($preprocessor === 'less'){
4141
locate_template( 'inc/library/lessphp-oyejorge.php', true ); // Lessphp-Oyejorge library
4242
}
4343

less/content.less

-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
body{
2-
border: 5px solid blue;
3-
}

less/footer.less

-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +0,0 @@
1-
2-
body{
3-
border: 5px solid blue;
4-
}

less/header.less

-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
body{
2-
border: 5px solid blue;
3-
}

less/home.less

-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
body{
2-
border: 5px solid blue;
3-
}

0 commit comments

Comments
 (0)