Never use env() outside of config files! It wont work in production
Jan 6, 2022
7
Level 4
Prevent formatting only JS on blade file (VScode)
Hi,
I have a blade file with some js code. I have this following setting on VS Code to format on save which is pretty convenient:
"[blade]": {
"editor.formatOnSave": true,
"editor.insertSpaces": false,
"editor.defaultFormatter": "amirmarmul.laravel-blade-vscode"
},
However, on my script, I have this line
<script>
let stripe = Stripe("{{ env("STRIPE_KEY")}}");
</script>
which is transformed to after formatting
let stripe = Stripe("{{ env("
STRIPE_KEY ")}}");
which of course does not work anymore since it's not inline.
Is there a solution to format on a same file both JS and HTML/Blade without impacting the syntax ?
Thank you in advance
Please or to participate in this conversation.