From 54df7614839eb12cd1f1d07323fca94a843310d7 Mon Sep 17 00:00:00 2001 From: Glauber Silva Date: Fri, 12 Apr 2024 11:33:08 -0300 Subject: [PATCH] chore: add comments related to the compiled assets files --- .../Actions/LoadFormBuilderAssets.php | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/FormExtension/FormBuilder/Actions/LoadFormBuilderAssets.php b/src/FormExtension/FormBuilder/Actions/LoadFormBuilderAssets.php index 9b19466..a94f570 100644 --- a/src/FormExtension/FormBuilder/Actions/LoadFormBuilderAssets.php +++ b/src/FormExtension/FormBuilder/Actions/LoadFormBuilderAssets.php @@ -15,11 +15,29 @@ class LoadFormBuilderAssets */ public function __invoke() { - $assets = ScriptAsset::get(trailingslashit(ADDON_CONSTANT_URL) . '/build/GiveAddonFormBuilderExtension.asset.php'); + /** + * This global path refers to the compiled version of the 'FormExtension/FormBuilder/resources/css/index.scss' style + */ $globalStylePath = trailingslashit(ADDON_CONSTANT_URL) . 'build/GiveAddonFormBuilderExtensionGlobalStyle.css'; + + /** + * This path refers to the compiled version of the '.module.scss' files present in the 'FormExtension/FormBuilder/resources/js/index.tsx' script + * + * When the 'FormExtension/FormBuilder/resources/js/index.tsx' file loads some component that uses '.module.scss' + * and it gets compiled with WP Scripts, then a .js file is generated in the build folder alongside a style file + * with the same entry name but with the .css extension. + */ $stylePath = trailingslashit(ADDON_CONSTANT_URL) . 'build/GiveAddonFormBuilderExtension.css'; + + /** + * This global path refers to the compiled version of the 'FormExtension/FormBuilder/resources/js/index.tsx' script + */ $scriptPath = trailingslashit(ADDON_CONSTANT_URL) . 'build/GiveAddonFormBuilderExtension.js'; + + + $assets = ScriptAsset::get(trailingslashit(ADDON_CONSTANT_URL) . '/build/GiveAddonFormBuilderExtension.asset.php'); + if (file_exists($globalStylePath)) { wp_enqueue_style( 'givewp-form-extension-ADDON_ID-global-style',