dcbc4dc588
* dev: update webpack build to dynamiclly fetch wp-admin-scripts * Update README.md * Update README.md |
||
---|---|---|
.. | ||
add-term-tracking | ||
attributes-tracking | ||
beta-features-tracking-modal | ||
category-tracking | ||
command-palette | ||
command-palette-analytics | ||
marketing-coupons | ||
onboarding-homepage-notice | ||
onboarding-load-sample-products-notice | ||
onboarding-product-import-notice | ||
onboarding-product-notice | ||
onboarding-tax-notice | ||
order-tracking | ||
payment-method-promotions | ||
print-shipping-label-banner | ||
product-category-metabox | ||
product-import-tracking | ||
product-tour | ||
product-tracking | ||
settings-tracking | ||
shipping-settings-region-picker | ||
tags-tracking | ||
variable-product-tour | ||
wc-addons-tour | ||
woo-connect-notice | ||
woo-enable-autorenew | ||
woo-plugin-update-connect-notice | ||
woo-product-usage-notice | ||
woo-renew-subscription | ||
woo-subscriptions-notice | ||
README.md |
README.md
WP Admin Scripts
Scripts located in this directory are meant to be loaded on wp-admin pages outside the context of WooCommerce Admin, such as the post editor.
Each subdirectory of this directory is automatically added as an entrypoint in the webpack build script of WooCommerce Admin. When they are built, each one results in a pair of <subdirectory-name>.asset.php
and <subdirectory-name>.js
file in the build\wp-admin-scripts\
path, but they will not be automatically loaded on every PHP page.
The <subdirectory-name>.asset.php
file contains a list of automatically detected dependencies generated by the Dependency Extraction Webpack Plugin, so JS dependencies are not required to be manually enqueued as long as the WCAdminAssets::register_script()
function is used to enqueue the script.
As an example, the payment-method-promotions
wp-admin-scripts has generated payment-method-promotions.asset.php
with the contents below:
<?php return array('dependencies' => array('react', 'wc-components', 'wc-experimental', 'wc-settings', 'wc-store-data', 'wc-tracks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => 'e64b1e69145febe07734');
And is registered as a script like so: plugins/woocommerce/src/Internal/Admin/WCPayPromotion/Init.php
,
WCAdminAssets::register_script( 'wp-admin-scripts', 'payment-method-promotions', true );