Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Enqueue a script with asset file
*
* @param string $script_url the URL to the script file
* @param string $handle the handle for the script
* @param string $translation_domain the translation domain
* @param string $translation_path the translation path
*/
function luther_utils_enqueue_script( $script_url, $handle = "", $translation_domain = "", $translation_path = "" ) {
@silaskoehler
silaskoehler / webpack.config.js
Last active May 21, 2024 18:21
Example webpack config override when using --experimental-modules flag with wp-scripts
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
const { merge } = require( 'webpack-merge' );
// get default configs
const [ scriptConfig, moduleConfig ] = defaultConfig;
/**
* Override script config
* the script config is the default config, which is used with or without the --experimental-modules flag