Skip to content

Commit

Permalink
Update Decorator file
Browse files Browse the repository at this point in the history
  • Loading branch information
mihatorikei committed Jul 11, 2022
1 parent 1f1ea3a commit b9fb90e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Config/env.default
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
VITE_ORIGIN='http://localhost:3479'
VITE_PORT=3479
VITE_BUILD_DIR='build'
VITE_BUILD_DIR= 'build'
VITE_ENTRY_FILE='main.js'
VITE_RESOURCES_DIR='resources'
VITE_FRAMEWORK='none'
# Set this to false, or otherwise the plugin will try to add a div with an app id in your view file
VITE_ADD_APP_ID='true'
VITE_BACKUP_FILE=
11 changes: 7 additions & 4 deletions src/Decorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ public static function decorate(string $html): string
# Insert tags just before "</head>" tag.
$html = empty($tags) ? $html : str_replace('</head>', "\n\t$tags\n</head>", $html);

# Insert app id just after body tag
$html = empty($tags) ? $html : str_replace('<body>', "<body>\n\t<div id=\"app\">", $html);
# Close it.
$html = empty($tags) ? $html : str_replace('</body>', "\n\t</div>\n</body>", $html);
if (env('VITE_ADD_APP_ID') == "true")
{
# Insert app id just after body tag
$html = empty($tags) ? $html : str_replace('<body>', "<body>\n\t<div id=\"app\">", $html);
# Close it.
$html = empty($tags) ? $html : str_replace('</body>', "\n\t</div>\n</body>", $html);
}
}

# If not, then just return the html as it is.
Expand Down

0 comments on commit b9fb90e

Please sign in to comment.