![](/img/trans.png)
[英]My Joomla Template is loading my custom CSS using JS. Is there a way to add the unique version tag to my custom CSS? i.e: custom.css?20180101
[英]My view does not seem to see my css,js. Am using spring boot and thymeleaf
这是我的login.html文件(查看)
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
<title>The Login Page</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script type="application/x-javascript" th:inline="javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:600italic,400,300,600,700' media="screen" rel='stylesheet' type='text/css' />
<link rel="stylesheet" th:href="@{/css/style.css}" media="screen" href="../public/css/style.css" />
</head>
<body>
<!-- start-main -->
<div class="container-fluid" style="border: 1px solid red;">
<!--start of the login form-->
<div class="login-form">
<div class="head">
<img th:src ="@{/images/mem2.jpg}" src="../public/images/mem2.jpg" alt=""/>
</div>
<form action="#" method="post" th:action="@{/login}" th:object="${user}">
<li>
<input type="text" class="text" name="username" placeholder="Username" th:field="*{username}" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Username';}" /><a href="#" class=" icon user" ></a>
<p th:if="${#fields.hasErrors('username')}" th:errors="*{username}">Username Error</p>
</li>
<li>
<input type="password" name="password" placeholder="Password" th:field="*{password}" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Password';}" /><a href="#" class=" icon lock"></a>
<p th:if="${#fields.hasErrors('password')}" th:errors="*{password}">Password Error</p>
</li>
<div class="p-container">
<label class="checkbox"><input type="checkbox" name="checkbox" checked="checked" /><i></i>Remember Me</label>
<input type="submit" value="SIGN IN" />
<div class="clear"> </div>
</div>
</form>
</div>
<!--//End-login-form-->
<!--start-copyright-->
<div class="copy-right">
<p th:include="footer :: footer"></p>
</div>
<!--//end-copyright-->
</div>
</body>
</html>
在这个login.html中,我使用thymeleaf来引用CSS,JS和图像
下面是我的pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.social.manager</groupId>
<artifactId>Social-Manager</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>SocialManagement</name>
<description>Social Management App</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-social-facebook</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-social-linkedin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-social-twitter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
请帮我完成有关该主题的其他帖子,但我似乎都没有帮助。
我的css文件放在src / main / resources / public下
SRC /主/资源/耻骨/ CSS
SRC /主/资源/公/ JS
SRC /主/资源/公/图片
我的模板文件位于:
SRC /主/资源/模板
如果没有资源处理程序处理这些路径,则@{/css/style.css}
将获得源代码的src/main/webapp/css/style.css
的文件; 最终战争包的文件夹结构与您的文件夹结构不同。
默认的Maven War Pack配置会将src/main/resources
内容放入WEB-INF/classes/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.