And*_*ndy 1 html css freemarker
我正在使用 spring-boot 和 spring-security 制作一个网站,它更喜欢提供 freemarker 作为视图。我对ftl不太了解,现在我需要在我的ftl中使用 adminLTE 的 CSS 和 JS 文件,但是如何呢?
<html lang="en">
<#assign basePath=request.contextPath>
<#macro head>
...
<script src="${basePath}WEB-INF/AdminLTE/dist/js/adminlte.min.js"></script>
<link src="${basePath}WEB-INF/AdminLTE/plugins/iCheck/line/line.css" rel="stylesheet"></link>
<script src="${basePath}WEB-INF/AdminLTE/plugins/iCheck/icheck.js"></script>
...
<#macro>
Run Code Online (Sandbox Code Playgroud)
您可以使用<#include >标签包含CSS文件,将样式表放在目录中并使用
<#include "/{path to style sheet}/Styles.css">
并确保您的样式表位于 styles 元素内:
<style type="text/css">
...
</style>
Run Code Online (Sandbox Code Playgroud)
这种方法的例子是
测试模板
<html>
<head>
<#include "css/test.css">
</head>
<body>
.......................
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
测试.css
<style type="text/css">
body{background-color:#C5C5C0;}
*{font-family:Tahoma, Verdana, Helvetica, sans-serif;}
</style>
Run Code Online (Sandbox Code Playgroud)