Skip to content

Commit

Permalink
refactor: art enqueue functions in ucsc-content-blocks.php (#31)
Browse files Browse the repository at this point in the history
* refactor: 🎨 Refactor enqueue scripts function.

* refactor: 🎨 Return enqueue to front end

* chore: 🚧 Merge changes down from Main, fix merge conflict.

* refactor: 🎨 fix function

* chore: 🔥 edit console.log output in `view.js`

* refactor: 🎨 #10 refactored enqueue functions. Working on enqueueing js.

* refactor: 🎨 #10 clean up enqueue scripts
  • Loading branch information
Herm71 authored Aug 9, 2023
1 parent 256a862 commit 803f971
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion blocks/src/details-wrapper/view.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log( 'Hello World' );
console.log( 'Hello Slug' );
1 change: 1 addition & 0 deletions js/detailswrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ if ( expandCollapses )
} );
} );
} );
console.log('Hello World');
22 changes: 18 additions & 4 deletions ucsc-content-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,27 @@
* Enqueue theme scripts and styles.
*/
function ucsc_content_block_scripts() {
wp_enqueue_style('dashicons');
wp_register_script( 'details-wrapper', plugin_dir_url( __FILE__ ) . 'js/detailswrapper.js', array(), wp_get_theme()->get( 'Version' ), true );
wp_enqueue_script( 'details-wrapper' );

wp_enqueue_style(
'dashicons'
);
}
add_action( 'wp_enqueue_scripts', 'ucsc_content_block_scripts' );

/**
* Enqueue additional block assets.
*/
function ucsc_content_block_assets() {
wp_enqueue_script(
'details-wrapper',
plugins_url ('/js/detailswrapper.js', __FILE__),
array(),
wp_get_theme()->get( 'Version' ),
true
);

}
add_action( 'enqueue_block_assets', 'ucsc_content_block_assets' );

/**
* Register blocks
*/
Expand Down

0 comments on commit 803f971

Please sign in to comment.