[英]Can I use webjars in IntelliJ without building the project?
在IntelliJ编译期间是否可以引用Webjar依赖项? 想象一下,我正在使用一些CSS或HTML并进行一些小的调整。.我不想清理->每次更改字体大小或颜色等时都重新构建项目。我只想即时预览它们,在IntelliJ中。
假设您具有webjars
Maven依赖项:
<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>${bootstrap.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>${jquery.version}</version>
</dependency>
您可以通过将以下代码放在模板中的<head></head>
来引用您的资源:
<link href="webjars/bootstrap/3.3.7-1/css/bootstrap.min.css" rel="stylesheet" media="screen"
th:href="@{/webjars/bootstrap/3.3.7-1/css/bootstrap.min.css}"/>
<script src="webjars/jquery/3.2.0/jquery.min.js"
th:src="@{/webjars/jquery/3.2.0/jquery.min.js}"></script>
属性href
和src
将在编译时使用,而Thymeleaf将在运行时使用属性th:href
和th:scr
。
以同样的方式,您可以使用自己的样式表或脚本:
<link href="../../static/css/app.css" th:href="@{css/app.css}" rel="stylesheet" media="screen"/>
<script src="../../static/js/app.js" th:src="@{js/app.js}"></script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.