Commit 73cf7fef authored by Jason Song's avatar Jason Song Committed by GitHub

auto append build time as version for js and css files (#2674)

parent 3d982b61
......@@ -41,9 +41,9 @@ public class WebMvcConfig implements WebMvcConfigurer, WebServerFactoryCustomize
// 10 days
addCacheControl(registry, "img", 864000);
addCacheControl(registry, "vendor", 864000);
addCacheControl(registry, "scripts", 864000);
addCacheControl(registry, "styles", 864000);
// 1 day
addCacheControl(registry, "scripts", 86400);
addCacheControl(registry, "styles", 86400);
addCacheControl(registry, "views", 86400);
addCacheControl(registry, "i18n", 86400);
}
......
......@@ -12,6 +12,7 @@
<name>Apollo Portal</name>
<properties>
<github.path>${project.artifactId}</github.path>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
</properties>
<dependencies>
<dependency>
......@@ -99,6 +100,36 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<basedir>${build.directory}</basedir>
<includes>
<include>classes/static/*.html</include>
<include>classes/static/**/*.html</include>
</includes>
<replacements>
<replacement>
<token>\.css\"</token>
<value>.css?v=${maven.build.timestamp}\"</value>
</replacement>
<replacement>
<token>\.js\"</token>
<value>.js?v=${maven.build.timestamp}\"</value>
</replacement>
</replacements>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment