css - Spring 和 Gradle - 添加到元素 WebJars Bootstrap

标签 css spring twitter-bootstrap thymeleaf

我想在我的服务 webjars Bootstrap 中使用。
我添加了依赖

compile group: 'org.webjars', name: 'bootstrap', version: '4.0.0-alpha.6-1'

我注册源
        registry
            .addResourceHandler("/webjars/**")
            .addResourceLocations("/webjars/");

我在 thymeleaf 中使用 Bootstrap css
<link rel="stylesheet" th:href="@{webjars/bootstrap/4.0.0-alpha.6-1/css/bootstrap.min.css}">

并且 Bootstrap 根本不起作用。没有元素。这个服务怎么没有看到 Bootstrap css 文件?在我使用的元素中,例如 Spring Security。会不会有什么影响?修理它是否值得? webjars 文件和“resource”文件夹中这样一个普通的 css 文件之间的速度是多少?

最佳答案

要将 Bootstrap 添加为 webjar,请将以下内容添加到 build.gradle:

dependencies {
    ...
    compile 'org.webjars:bootstrap:4.1.3'
}

并将其附加到 html 模板:
<body>
<script src="/webjars/bootstrap/4.1.3/js"></script>
...
</body>

关于css - Spring 和 Gradle - 添加到元素 WebJars Bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43821396/

相关文章:

HTML 元素选择视觉上不均匀,出现竖线

java - 错误类型错误: Cannot set property 'name' of undefined

java - 使用 Hibernate 以及 IBatis 和 jdbc 连接池需要进行哪些更改

javascript - 使用 AngularJS 动态更改时,Bootstrap 工具提示的数据放置不起作用

html - 使用 Bootstrap 居中下拉菜单

javascript - 单击/使部分居中时如何更改 h1 标题

javascript - 即使单击后也更改按钮颜色

css - 在元素悬停时显示图标

java - 从SecurityContextHolder获取电子邮件地址 spring java MVC

jquery - 在 ASP.NET 中设置 Twitter Bootstrap 按钮单选组的事件状态