webjars 认知

2018-10-24  本文已影响0人  红紫黑白灰

什么是webjars

WebJars是将客户端(浏览器)资源(JavaScript,Css等)打成jar包文件,以对资源进行统一依赖管理。WebJars的jar包部署在Maven中央仓库上。

添加依赖

<dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.7-1</version>
</dependency>

注意

页面头部需添加外部链接
举例

<html xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>主页</title>
    <link rel="stylesheet" href="/webjars/bootstrap/3.3.7-1/css/bootstrap.css">
</head>
<body>
<h2>例子</h2>
<h2>Hello Thymeleaf~</h2>
<div class="container">
    <div class="alert alert-success">
        <p th:text="${student.name}"></p>
    </div>
</div>
</body>
</html>

更多了解

https://www.webjars.org/

上一篇 下一篇

猜你喜欢

热点阅读