Skip to content

Commit

Permalink
js stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
erikyo committed Oct 13, 2023
1 parent beec6ef commit 7e51316
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 19 deletions.
4 changes: 2 additions & 2 deletions admin/CF7_AntiSpam_Admin_Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ public function enqueue_scripts() {
* class.
*/

$asset = include CF7ANTISPAM_PLUGIN_DIR . '/admin/dist/admin-scripts.asset.php';
wp_register_script( $this->plugin_name, CF7ANTISPAM_PLUGIN_URL . '/admin/dist/admin-scripts.js', $asset['dependencies'], $asset['version'], true );
$asset = include CF7ANTISPAM_PLUGIN_DIR . '/build/admin-scripts.asset.php';
wp_register_script( $this->plugin_name, CF7ANTISPAM_PLUGIN_URL . '/build/admin-scripts.js', $asset['dependencies'], $asset['version'], true );
wp_enqueue_script( $this->plugin_name );

wp_localize_script(
Expand Down
4 changes: 2 additions & 2 deletions core/CF7_AntiSpam_Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ public function enqueue_scripts() {
* class.
*/

$asset = include CF7ANTISPAM_PLUGIN_DIR . '/includes/dist/script.asset.php';
wp_register_script( $this->plugin_name, CF7ANTISPAM_PLUGIN_URL . '/includes/dist/script.js', $asset['dependencies'], $asset['version'], true );
$asset = include CF7ANTISPAM_PLUGIN_DIR . '/build/script.asset.php';
wp_register_script( $this->plugin_name, CF7ANTISPAM_PLUGIN_URL . '/build/script.js', $asset['dependencies'], $asset['version'], true );
wp_enqueue_script( $this->plugin_name );

wp_localize_script(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 6 additions & 15 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
const path = require( 'path' );

const addModule = ( fileName, filePath ) => {
return {
...defaultConfig,
name: fileName,
entry: path.resolve( __dirname, filePath + fileName ),
output: {
path: path.resolve( __dirname, filePath + '../dist/' ),
filename: fileName,
},
};
module.exports = {
...defaultConfig,
entry: {
script: path.resolve( process.cwd(), `src/script.js` ),
'admin-scripts': path.resolve( process.cwd(), `src/admin-scripts.js` ),
},
};

const mainScript = addModule( 'script.js', 'core/src/' );
const adminScript = addModule( 'admin-scripts.js', 'admin/src/' );

module.exports = [ mainScript, adminScript ];

0 comments on commit 7e51316

Please sign in to comment.