Skip to content

Commit e0f85d4

Browse files
Separate SimpleBar so it can easily be consumed by others
1 parent 53e5e58 commit e0f85d4

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

app/integrations/facetwp/template-functions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function bigbox_facetwp_wp_enqueue_scripts() {
2424

2525
$deps = [
2626
$stylesheet,
27+
( $stylesheet . '-simplebar' ),
2728
'jquery',
2829
];
2930

app/integrations/woocommerce/template-functions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ function bigbox_woocommerce_wp_enqueue_scripts() {
4040

4141
$deps = [
4242
$stylesheet,
43+
( $stylesheet . '-simplebar' ),
4344
'wp-util',
4445
'woocommerce',
4546
];

app/theme/assets.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,21 @@ function bigbox_enqueue_scripts() {
7373
$version = bigbox_get_theme_version();
7474
$stylesheet = bigbox_get_theme_name();
7575

76+
// SimpleBar.
77+
wp_enqueue_script(
78+
$stylesheet . '-simplebar',
79+
get_template_directory_uri() . '/public/js/simplebar.min.js',
80+
array(),
81+
'4.1.0',
82+
true
83+
);
84+
7685
$deps = [
7786
'hoverIntent',
87+
( $stylesheet . '-simplebar' ),
7888
];
7989

80-
// Combined application scripts.
90+
// Application script.
8191
wp_enqueue_script(
8292
$stylesheet,
8393
get_template_directory_uri() . '/public/js/app.min.js',

resources/assets/js/app/horizontal-menu.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
/**
2-
* Extenal dependencies.
3-
*/
4-
import SimpleBar from 'simplebar';
1+
/* global SimpleBar */
52

63
/**
74
* Scroll a horizontal menu to the active item.

webpack.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ const config = {
114114
jquery: 'jQuery',
115115
$: 'jQuery',
116116
'@wordpress/element': 'wp.element',
117+
simplebar: 'window.SimpleBar',
117118
},
118119
plugins: [
119120
new SpritePlugin(),
@@ -122,6 +123,10 @@ const config = {
122123
from: 'resources/assets/images/icons',
123124
to: 'public/images/icons',
124125
},
126+
{
127+
from: './node_modules/simplebar/dist/simplebar.min.js',
128+
to: 'public/js/simplebar.min.js',
129+
},
125130
] ),
126131
new MiniCssExtractPlugin( {
127132
filename: './public/css/[name].min.css',

0 commit comments

Comments
 (0)