-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Is your feature request related to a problem? Please describe.
I'm writing a custom preprocessor. It processes the entire file (i.e. markup) and needs to generate some JavaScript. It does that by outputting a new <script> block. Unfortunately, if the svelte file already has a <script> block, I get an error telling me that a page is only allowed to have a single <script> block. This sounds like an unnecessary restriction.
Describe the solution you'd like
A svelte page should be allowed to have any number of <script> blocks. The same should probably go for <style> blocks.
Describe alternatives you've considered
I've considered just checking if the current page already has a <script> block and just injecting JavaScript into that block. The problem is that the existing <script> block may specify coffeescript or some other preprocessor already. Then I'd have to inject coffeescript instead of plain JavaScript. And what happens if there's some other language used in the future?
How important is this feature to you?
I can work around the problem for now, but I think that a successful solution would require my suggestion be implemented.