简体   繁体   English

使用Razor维护@section标签内的Javascript代码突出显示

[英]Maintaining Javascript Code highlighting inside @section tag with Razor

I've joined a new dev team. 我加入了一个新的开发团队。 They have javascript & knockout inside a @section {} declaration in their razor views. 他们在剃须刀视图的@section {}声明中包含javascript和剔除功能。 The javascript has no color highlighting at all, how can I get around this? javascript根本没有突出显示颜色,我该如何解决?

Thanks! 谢谢!

Unfortunately, there's nothing you can really do there. 不幸的是,您在此实际上无能为力。 My suggestion would be to get rid of the javascript inside your views, and move them to external JS-files. 我的建议是摆脱视图中的javascript,并将其移至外部JS文件。

Of course, you could (and should) do this gradually. 当然,您可以(并且应该)逐步执行此操作。 A good approach would be to move a script every time you need to edit it. 一个好的方法是每次需要编辑脚本时都将其移动。 That way you always benefit from highlighting but don't need to spend a lot of time upfront on refactoring. 这样一来,您始终可以从突出显示中受益,而无需花很多时间在重构上。 You'll end up with a cleaner solution as well. 您最终还将获得更清洁的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM