Created
May 7, 2019 07:19
-
-
Save steffenz/cca5b6e29bc410e7f14e5c405dbef5b3 to your computer and use it in GitHub Desktop.
Embedding React application inside a WordPress plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$scripts = preg_grep('~\.(js)$~', scandir(__DIR__. '/../react-frontend/build/static/js')); | |
foreach($scripts as $script){ | |
wp_enqueue_script("react-{$script}", plugin_dir_url( __FILE__ ). "./../react-frontend/build/static/js/{$script}"); | |
} | |
echo "<div id="root">Enabled JavaScript to see this page</div>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment