启用 html 和 javascript 文件的 IntelliJ 热交换

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18492457/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 12:09:03  来源:igfitidea点击:

Enable IntelliJ hotswap of html and javascript files

javascripthtmlcssintellij-ideahotswap

提问by Mike Hopper

I'm fairly new to IntelliJ and I'm using it to develop an AngularJS / Java web application. When I make changes to HTML or JavaScript code, I always have to restart the app server (I'm using Jetty). Is there a config or plugin that provides hotswap for HTML/JS/CSS files?

我对 IntelliJ 相当陌生,我正在使用它来开发 AngularJS/Java Web 应用程序。当我更改 HTML 或 JavaScript 代码时,我总是必须重新启动应用程序服务器(我使用的是 Jetty)。是否有为 HTML/JS/CSS 文件提供热交换的配置或插件?

I'm using IntelliJ 12 Ultimate edition.

我正在使用 IntelliJ 12 Ultimate 版。

采纳答案by chalimartines

You need the option "Update resources". You should be able find this option in your server Run/Debug configuration.

您需要“更新资源”选项。您应该能够在服务器运行/调试配置中找到此选项。

回答by Rafael Reyes

I had the same problem but I already fixed it. You can follow this steps:

我有同样的问题,但我已经解决了。您可以按照以下步骤操作:

  1. Go to Help->Find Action
  2. Type "Registry".
  3. Find and mark : “compiler.automake.allow.when.app.running”.
  4. Close the Dialog.
  5. Go to "Settings->Build, Execution, Deployment->Compiler".
  6. Mark "Build project automatically".
  7. Apply changes.
  8. Go to Spring Boot Configuration and if everything goes well it will display a warning about "background compilation", Run your Spring Boot Application and you should be able to see your statisc's files changes when refresh your browser.
  1. 转到帮助-> 查找操作
  2. 输入“注册表”。
  3. 找到并标记:“compiler.automake.allow.when.app.running”。
  4. 关闭对话框。
  5. 转到“设置->构建、执行、部署->编译器”。
  6. 标记“自动构建项目”。
  7. 应用更改。
  8. 转到 Spring Boot 配置,如果一切顺利,它将显示关于“后台编译”的警告,运行您的 Spring Boot 应用程序,您应该能够在刷新浏览器时看到 statisc 的文件更改。

Hope it helps.

希望能帮助到你。

回答by user2409548

As i found this thread interesting, i also found a lot of explanations here: https://www.jetbrains.com/idea/help/updating-applications-on-application-servers.html

因为我发现这个线程很有趣,我还在这里找到了很多解释:https: //www.jetbrains.com/idea/help/updating-applications-on-application-servers.html

回答by GoodJobException

One more thing, which might not be obvious - to activate the automatic build you have to activate the IntelliJ window. It is still very convenient, although you have to switch windows when operation only in the browser.

还有一件事,这可能并不明显 - 要激活自动构建,您必须激活 IntelliJ 窗口。还是很方便的,虽然只能在浏览器中操作时要切换窗口。

回答by pradip9102

Also, a keyboard shortcut(e.g. Ctrl+F5 or Cmd+F5) to "Run -> Reload changed classes" might come handy. It helps me to save changes multiple times and then restart the server when I'm done (unless using JRebel :)

此外,“运行 -> 重新加载已更改的类”的键盘快捷键(例如 Ctrl+F5 或 Cmd+F5)可能会派上用场。它可以帮助我多次保存更改,然后在完成后重新启动服务器(除非使用 JRebel :)