CSS & JS file versioning

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

CSS & JS file versioning

lol lol
Hi All,
 
Is there any possibility defined that lets me define my own placeholders in the html-template?
For example im using an html template with the following line
 
    <link rel="stylesheet" type="text/css" href="${application}.css">
 
Is there anything helpful already existing in the compiler so I can add a version to my css like so:
 
href="${application}?v=12345678" />
 
Thank!
Reply | Threaded
Open this post in threaded view
|

Re: CSS & JS file versioning

Carlos Rovira-2
Hi,

I think you need "htmlTemplate" compiler option. This is how to use in Maven:

<htmlTemplate>${basedir}/target/javascript/bin/js-debug/jewel-example-index-template.html</htmlTemplate>

in command line:

-html-template=src/main/resources/jewel-example-index-template.html

or in asconfig:

"html-template": "src/main/resources/jewel-example-index-template.html"

HTH

Carlos



El mar, 12 ene 2021 a las 10:47, lol lol (<[hidden email]>) escribió:
Hi All,
 
Is there any possibility defined that lets me define my own placeholders in the html-template?
For example im using an html template with the following line
 
    <link rel="stylesheet" type="text/css" href="${application}.css">
 
Is there anything helpful already existing in the compiler so I can add a version to my css like so:
 
href="${application}?v=12345678" />
 
Thank!


--
Carlos Rovira
Apache Member & Apache Royale PMC
Apache Software Foundation

Reply | Threaded
Open this post in threaded view
|

Re: CSS & JS file versioning

Harbs
I think the question was how to automatically insert the build number into the html (i.e.?v=12345678)

On Jan 12, 2021, at 1:41 PM, Carlos Rovira <[hidden email]> wrote:

Hi,

I think you need "htmlTemplate" compiler option. This is how to use in Maven:

<htmlTemplate>${basedir}/target/javascript/bin/js-debug/jewel-example-index-template.html</htmlTemplate>

in command line:

-html-template=src/main/resources/jewel-example-index-template.html

or in asconfig:

"html-template": "src/main/resources/jewel-example-index-template.html"

HTH

Carlos



El mar, 12 ene 2021 a las 10:47, lol lol (<[hidden email]>) escribió:
Hi All,
 
Is there any possibility defined that lets me define my own placeholders in the html-template?
For example im using an html template with the following line
 
    <link rel="stylesheet" type="text/css" href="${application}.css">
 
Is there anything helpful already existing in the compiler so I can add a version to my css like so:
 
href="${application}?v=12345678" />
 
Thank!


--
Carlos Rovira
Apache Member & Apache Royale PMC
Apache Software Foundation


Reply | Threaded
Open this post in threaded view
|

Aw: Re: CSS & JS file versioning

lol lol
Indeed, it was more about whether the "html-template" supports own placeholders and versioning per se.
 
 
Gesendet: Dienstag, 12. Januar 2021 um 13:14 Uhr
Von: "Harbs" <[hidden email]>
An: [hidden email]
Betreff: Re: CSS & JS file versioning
I think the question was how to automatically insert the build number into the html (i.e.?v=12345678)
 
On Jan 12, 2021, at 1:41 PM, Carlos Rovira <[hidden email]> wrote:
 
Hi,
 
I think you need "htmlTemplate" compiler option. This is how to use in Maven:
 
<htmlTemplate>${basedir}/target/javascript/bin/js-debug/jewel-example-index-template.html</htmlTemplate>
 
in command line:
 
-html-template=src/main/resources/jewel-example-index-template.html
 
or in asconfig:
 
"html-template": "src/main/resources/jewel-example-index-template.html"
 
HTH
 
Carlos
 
 
 
El mar, 12 ene 2021 a las 10:47, lol lol (<[hidden email]>) escribió:
Hi All,
 
Is there any possibility defined that lets me define my own placeholders in the html-template?
For example im using an html template with the following line
 
    <link rel="stylesheet" type="text/css" href="${application}.css">
 
Is there anything helpful already existing in the compiler so I can add a version to my css like so:
 
href="${application}?v=12345678" />
 
Thank!
 
 
--
Carlos Rovira
Apache Member & Apache Royale PMC
Apache Software Foundation
 
Reply | Threaded
Open this post in threaded view
|

Re: CSS & JS file versioning

Harbs
I don’t think we have that yet, but I believe the place to add it would be in MXMLRoyalePublisher.java and MXMLApplicationNode.java

Note specifically the following commented lines in MXMLRoyalePublisher.java:

        //result = result.replaceAll("\\$\\{version_major\\}", versionMajor);
        //result = result.replaceAll("\\$\\{version_minor\\}", versionMinor);
        //result = result.replaceAll("\\$\\{version_revision\\}", versionRevision);

You’d want to parse out the specific tags and enable the above lines.

On Jan 12, 2021, at 2:27 PM, lol lol <[hidden email]> wrote:

Indeed, it was more about whether the "html-template" supports own placeholders and versioning per se.
 
 
Gesendet: Dienstag, 12. Januar 2021 um 13:14 Uhr
Von: "Harbs" <[hidden email]>
An: [hidden email]
Betreff: Re: CSS & JS file versioning
I think the question was how to automatically insert the build number into the html (i.e.?v=12345678)
 
On Jan 12, 2021, at 1:41 PM, Carlos Rovira <[hidden email]> wrote:
 
Hi,
 
I think you need "htmlTemplate" compiler option. This is how to use in Maven:
 
<htmlTemplate>${basedir}/target/javascript/bin/js-debug/jewel-example-index-template.html</htmlTemplate>
 
in command line:
 
-html-template=src/main/resources/jewel-example-index-template.html
 
or in asconfig:
 
"html-template": "src/main/resources/jewel-example-index-template.html"
 
HTH
 
Carlos
 
 
 
El mar, 12 ene 2021 a las 10:47, lol lol (<[hidden email]>) escribió:
Hi All,
 
Is there any possibility defined that lets me define my own placeholders in the html-template?
For example im using an html template with the following line
 
    <link rel="stylesheet" type="text/css" href="${application}.css">
 
Is there anything helpful already existing in the compiler so I can add a version to my css like so:
 
href="${application}?v=12345678" />
 
Thank!
 
 
--
Carlos Rovira
Apache Member & Apache Royale PMC
Apache Software Foundation
 

Reply | Threaded
Open this post in threaded view
|

Re: CSS & JS file versioning

Alex Harui-2

Without considering whether that’s the right place to change the code, I would not be in favor of adding more variables to the template unless they cannot be specified some other way.  If you have to add a compiler option to specify a variable that goes in the output, I think it would be better to just use some build tool to do the string substitution.  The goal of the compiler output in a template is to have the compiler specify things that are not easily determined, like a width/height which is in an MXML file, or must already be specified like the appname.

 

Of course, this is open source so folks can decide differently, but just wanted to share my 2 cents,

-Alex

 

From: Harbs <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Tuesday, January 12, 2021 at 5:02 AM
To: "[hidden email]" <[hidden email]>
Subject: Re: CSS & JS file versioning

 

I don’t think we have that yet, but I believe the place to add it would be in MXMLRoyalePublisher.java and MXMLApplicationNode.java

 

Note specifically the following commented lines in MXMLRoyalePublisher.java:

 

        //result = result.replaceAll("\\$\\{version_major\\}", versionMajor);

        //result = result.replaceAll("\\$\\{version_minor\\}", versionMinor);

        //result = result.replaceAll("\\$\\{version_revision\\}", versionRevision);

 

You’d want to parse out the specific tags and enable the above lines.



On Jan 12, 2021, at 2:27 PM, lol lol <[hidden email]> wrote:

 

Indeed, it was more about whether the "html-template" supports own placeholders and versioning per se.

 

 

Gesendet: Dienstag, 12. Januar 2021 um 13:14 Uhr
Von: "Harbs" <[hidden email]>
An: [hidden email]
Betreff: Re: CSS & JS file versioning

I think the question was how to automatically insert the build number into the html (i.e.?v=12345678)

 

On Jan 12, 2021, at 1:41 PM, Carlos Rovira <[hidden email]> wrote:

 

Hi,

 

I think you need "htmlTemplate" compiler option. This is how to use in Maven:

 

<htmlTemplate>${basedir}/target/javascript/bin/js-debug/jewel-example-index-template.html</htmlTemplate>

 

in command line:

 

-html-template=src/main/resources/jewel-example-index-template.html

 

or in asconfig:

 

"html-template": "src/main/resources/jewel-example-index-template.html"

 

HTH

 

Carlos

 

 

 

El mar, 12 ene 2021 a las 10:47, lol lol (<[hidden email]>) escribió:

Hi All,

 

Is there any possibility defined that lets me define my own placeholders in the html-template?

For example im using an html template with the following line

 

    <link rel="stylesheet" type="text/css" href="${application}.css">

 

Is there anything helpful already existing in the compiler so I can add a version to my css like so:

 

href="${application}?v=12345678" />

 

Thank!

 

 

--

Carlos Rovira

Apache Member & Apache Royale PMC

Apache Software Foundation

 

 

Reply | Threaded
Open this post in threaded view
|

RE: [EXTERNAL] CSS & JS file versioning

Brian Raymes
In reply to this post by lol lol

As others have stated, there are other ways to do this. Here is how I’m doing it with maven:

 

In my case, I’m currently using a timestamp to try to avoid caching. Feel free to replace with a version, etc.

 

This will update the template and build time.

 

  <properties>

    <timestamp>${maven.build.timestamp}</timestamp>

  </properties>

 

 

      <plugin>

        <groupId>com.google.code.maven-replacer-plugin</groupId>

        <artifactId>replacer</artifactId>

        <version>1.5.3</version>

        <executions>

          <execution>

            <phase>package</phase>

            <goals>

              <goal>replace</goal>

            </goals>

          </execution>

        </executions>

        <configuration>

          <ignoreMissingFile>false</ignoreMissingFile>

          <file>${basedir}/target/javascript/bin/js-debug/index.html</file>

          <replacements>

            <replacement>

              <token><![CDATA[App.js]]></token>

              <value><![CDATA[App.js?v=${timestamp}]]></value>

            </replacement>

            <replacement>

              <token><![CDATA[App.css]]></token>

              <value><![CDATA[App.css?v=${timestamp}]]></value>

            </replacement>

          </replacements>

        </configuration>

      </plugin>

 

Brian

 

From: lol lol <[hidden email]>
Sent: Tuesday, January 12, 2021 1:47 AM
To: [hidden email]
Subject: [EXTERNAL] CSS & JS file versioning

 

Hi All,

 

Is there any possibility defined that lets me define my own placeholders in the html-template?

For example im using an html template with the following line

 

    <link rel="stylesheet" type="text/css" href="${application}.css">

 

Is there anything helpful already existing in the compiler so I can add a version to my css like so:

 

href="${application}?v=12345678" />

 

Thank!

Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] CSS & JS file versioning

Carlos Rovira-2
Thanks Brian,

very useful!

Not related, but as well useful, I use maven's build timestamp with defines to get it in AS3 in the following way:


Best,

Carlos

El mar, 12 ene 2021 a las 19:01, Brian Raymes (<[hidden email]>) escribió:

As others have stated, there are other ways to do this. Here is how I’m doing it with maven:

 

In my case, I’m currently using a timestamp to try to avoid caching. Feel free to replace with a version, etc.

 

This will update the template and build time.

 

  <properties>

    <timestamp>${maven.build.timestamp}</timestamp>

  </properties>

 

 

      <plugin>

        <groupId>com.google.code.maven-replacer-plugin</groupId>

        <artifactId>replacer</artifactId>

        <version>1.5.3</version>

        <executions>

          <execution>

            <phase>package</phase>

            <goals>

              <goal>replace</goal>

            </goals>

          </execution>

        </executions>

        <configuration>

          <ignoreMissingFile>false</ignoreMissingFile>

          <file>${basedir}/target/javascript/bin/js-debug/index.html</file>

          <replacements>

            <replacement>

              <token><![CDATA[App.js]]></token>

              <value><![CDATA[App.js?v=${timestamp}]]></value>

            </replacement>

            <replacement>

              <token><![CDATA[App.css]]></token>

              <value><![CDATA[App.css?v=${timestamp}]]></value>

            </replacement>

          </replacements>

        </configuration>

      </plugin>

 

Brian

 

From: lol lol <[hidden email]>
Sent: Tuesday, January 12, 2021 1:47 AM
To: [hidden email]
Subject: [EXTERNAL] CSS & JS file versioning

 

Hi All,

 

Is there any possibility defined that lets me define my own placeholders in the html-template?

For example im using an html template with the following line

 

    <link rel="stylesheet" type="text/css" href="${application}.css">

 

Is there anything helpful already existing in the compiler so I can add a version to my css like so:

 

href="${application}?v=12345678" />

 

Thank!



--
Carlos Rovira
Apache Member & Apache Royale PMC
Apache Software Foundation

Reply | Threaded
Open this post in threaded view
|

RE: [EXTERNAL] CSS & JS file versioning

Brian Raymes

Oooh! I didn’t know we could do that. Very neat!

 

Thank you for sharing.

 

Brian

 

From: Carlos Rovira <[hidden email]>
Sent: Thursday, January 14, 2021 1:27 AM
To: [hidden email]
Subject: Re: [EXTERNAL] CSS & JS file versioning

 

Thanks Brian,

 

very useful!

 

Not related, but as well useful, I use maven's build timestamp with defines to get it in AS3 in the following way:

 

 

Best,

 

Carlos

 

El mar, 12 ene 2021 a las 19:01, Brian Raymes (<[hidden email]>) escribió:

As others have stated, there are other ways to do this. Here is how I’m doing it with maven:

 

In my case, I’m currently using a timestamp to try to avoid caching. Feel free to replace with a version, etc.

 

This will update the template and build time.

 

  <properties>

    <timestamp>${maven.build.timestamp}</timestamp>

  </properties>

 

 

      <plugin>

        <groupId>com.google.code.maven-replacer-plugin</groupId>

        <artifactId>replacer</artifactId>

        <version>1.5.3</version>

        <executions>

          <execution>

            <phase>package</phase>

            <goals>

              <goal>replace</goal>

            </goals>

          </execution>

        </executions>

        <configuration>

          <ignoreMissingFile>false</ignoreMissingFile>

          <file>${basedir}/target/javascript/bin/js-debug/index.html</file>

          <replacements>

            <replacement>

              <token><![CDATA[App.js]]></token>

              <value><![CDATA[App.js?v=${timestamp}]]></value>

            </replacement>

            <replacement>

              <token><![CDATA[App.css]]></token>

              <value><![CDATA[App.css?v=${timestamp}]]></value>

            </replacement>

          </replacements>

        </configuration>

      </plugin>

 

Brian

 

From: lol lol <[hidden email]>
Sent: Tuesday, January 12, 2021 1:47 AM
To: [hidden email]
Subject: [EXTERNAL] CSS & JS file versioning

 

Hi All,

 

Is there any possibility defined that lets me define my own placeholders in the html-template?

For example im using an html template with the following line

 

    <link rel="stylesheet" type="text/css" href="${application}.css">

 

Is there anything helpful already existing in the compiler so I can add a version to my css like so:

 

href="${application}?v=12345678" />

 

Thank!


 

--

Carlos Rovira

Apache Member & Apache Royale PMC

Apache Software Foundation

 

Reply | Threaded
Open this post in threaded view
|

RE: [EXTERNAL] CSS & JS file versioning

Brian Raymes
In reply to this post by Carlos Rovira-2

FYI, I have expanded upon this for my debug version as well:

This adds a timestamp to ever every js reference provided in the debug output to hopefully thwart the cache. I’ve been having to clear my cache a lot lately, and I’m hoping this removes the need.

 

      <plugin>

        <groupId>com.google.code.maven-replacer-plugin</groupId>

        <artifactId>replacer</artifactId>

        <version>1.5.3</version>

        <executions>

          <execution>

            <phase>package</phase>

            <goals>

              <goal>replace</goal>

            </goals>

          </execution>

        </executions>

        <configuration>

          <ignoreMissingFile>false</ignoreMissingFile>

          <file>${basedir}/target/javascript/bin/js-debug/index.html</file>

          <replacements>

            <replacement>

              <token><![CDATA[((goog\.addDependency)(.)*)(\.js)]]></token>

              <value><![CDATA[$1.js?v=${timestamp}]]></value>

            </replacement>

            <replacement>

              <token><![CDATA[App.css]]></token>

              <value><![CDATA[App.css?v=${timestamp}]]></value>

            </replacement>

          </replacements>

        </configuration>

      </plugin>

 

 

 

From: Carlos Rovira <[hidden email]>
Sent: Thursday, January 14, 2021 1:27 AM
To: [hidden email]
Subject: Re: [EXTERNAL] CSS & JS file versioning

 

Thanks Brian,

 

very useful!

 

Not related, but as well useful, I use maven's build timestamp with defines to get it in AS3 in the following way:

 

 

Best,

 

Carlos

 

El mar, 12 ene 2021 a las 19:01, Brian Raymes (<[hidden email]>) escribió:

As others have stated, there are other ways to do this. Here is how I’m doing it with maven:

 

In my case, I’m currently using a timestamp to try to avoid caching. Feel free to replace with a version, etc.

 

This will update the template and build time.

 

  <properties>

    <timestamp>${maven.build.timestamp}</timestamp>

  </properties>

 

 

      <plugin>

        <groupId>com.google.code.maven-replacer-plugin</groupId>

        <artifactId>replacer</artifactId>

        <version>1.5.3</version>

        <executions>

          <execution>

            <phase>package</phase>

            <goals>

              <goal>replace</goal>

            </goals>

          </execution>

        </executions>

        <configuration>

          <ignoreMissingFile>false</ignoreMissingFile>

          <file>${basedir}/target/javascript/bin/js-debug/index.html</file>

          <replacements>

            <replacement>

              <token><![CDATA[App.js]]></token>

              <value><![CDATA[App.js?v=${timestamp}]]></value>

            </replacement>

            <replacement>

              <token><![CDATA[App.css]]></token>

              <value><![CDATA[App.css?v=${timestamp}]]></value>

            </replacement>

          </replacements>

        </configuration>

      </plugin>

 

Brian

 

From: lol lol <[hidden email]>
Sent: Tuesday, January 12, 2021 1:47 AM
To: [hidden email]
Subject: [EXTERNAL] CSS & JS file versioning

 

Hi All,

 

Is there any possibility defined that lets me define my own placeholders in the html-template?

For example im using an html template with the following line

 

    <link rel="stylesheet" type="text/css" href="${application}.css">

 

Is there anything helpful already existing in the compiler so I can add a version to my css like so:

 

href="${application}?v=12345678" />

 

Thank!


 

--

Carlos Rovira

Apache Member & Apache Royale PMC

Apache Software Foundation

 

Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] CSS & JS file versioning

Harbs
That’s not necessary. All browsers have a checkbox to disable cache while devtools are open.

HTH,
Harbs

On Jan 23, 2021, at 1:58 AM, Brian Raymes <[hidden email]> wrote:

FYI, I have expanded upon this for my debug version as well:

This adds a timestamp to ever every js reference provided in the debug output to hopefully thwart the cache. I’ve been having to clear my cache a lot lately, and I’m hoping this removes the need.
 
      <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>replacer</artifactId>
        <version>1.5.3</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>replace</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <ignoreMissingFile>false</ignoreMissingFile>
          <file>${basedir}/target/javascript/bin/js-debug/index.html</file>
          <replacements>
            <replacement>
              <token><![CDATA[((goog\.addDependency)(.)*)(\.js)]]></token>
              <value><![CDATA[$1.js?v=${timestamp}]]></value>
            </replacement>
            <replacement>
              <token><![CDATA[App.css]]></token>
              <value><![CDATA[App.css?v=${timestamp}]]></value>
            </replacement>
          </replacements>
        </configuration>
      </plugin>
 
 
 
From: Carlos Rovira <[hidden email]> 
Sent: Thursday, January 14, 2021 1:27 AM
To: [hidden email]
Subject: Re: [EXTERNAL] CSS & JS file versioning
 
Thanks Brian,
 
very useful!
 
Not related, but as well useful, I use maven's build timestamp with defines to get it in AS3 in the following way:
 
 
Best,
 
Carlos
 
El mar, 12 ene 2021 a las 19:01, Brian Raymes (<[hidden email]>) escribió:
As others have stated, there are other ways to do this. Here is how I’m doing it with maven:
 
In my case, I’m currently using a timestamp to try to avoid caching. Feel free to replace with a version, etc.
 
This will update the template and build time.
 
  <properties>
    <timestamp>${maven.build.timestamp}</timestamp>
  </properties>
 
 
      <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>replacer</artifactId>
        <version>1.5.3</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>replace</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <ignoreMissingFile>false</ignoreMissingFile>
          <file>${basedir}/target/javascript/bin/js-debug/index.html</file>
          <replacements>
            <replacement>
              <token><![CDATA[App.js]]></token>
              <value><![CDATA[App.js?v=${timestamp}]]></value>
            </replacement>
            <replacement>
              <token><![CDATA[App.css]]></token>
              <value><![CDATA[App.css?v=${timestamp}]]></value>
            </replacement>
          </replacements>
        </configuration>
      </plugin>
 
Brian
 
From: lol lol <[hidden email]> 
Sent: Tuesday, January 12, 2021 1:47 AM
To: [hidden email]
Subject: [EXTERNAL] CSS & JS file versioning
 
Hi All,
 
Is there any possibility defined that lets me define my own placeholders in the html-template?
For example im using an html template with the following line
 
    <link rel="stylesheet" type="text/css" href="${application}.css">
 
Is there anything helpful already existing in the compiler so I can add a version to my css like so:
 
href="${application}?v=12345678" />
 
Thank!

 
-- 
Carlos Rovira
Apache Member & Apache Royale PMC
Apache Software Foundation

Reply | Threaded
Open this post in threaded view
|

RE: [EXTERNAL] CSS & JS file versioning

Brian Raymes

Can you describe your workflow with that setting? Chrome, for example, turns that off with every launch.

 

I miss the days when I could launch a browser with the cache disabled. I wish it were still possible.

 

 

From: Harbs <[hidden email]>
Sent: Saturday, January 23, 2021 11:32 AM
To: [hidden email]
Subject: Re: [EXTERNAL] CSS & JS file versioning

 

That’s not necessary. All browsers have a checkbox to disable cache while devtools are open.

 

HTH,

Harbs



On Jan 23, 2021, at 1:58 AM, Brian Raymes <[hidden email]> wrote:

 

FYI, I have expanded upon this for my debug version as well:

This adds a timestamp to ever every js reference provided in the debug output to hopefully thwart the cache. I’ve been having to clear my cache a lot lately, and I’m hoping this removes the need.

 

      <plugin>

        <groupId>com.google.code.maven-replacer-plugin</groupId>

        <artifactId>replacer</artifactId>

        <version>1.5.3</version>

        <executions>

          <execution>

            <phase>package</phase>

            <goals>

              <goal>replace</goal>

            </goals>

          </execution>

        </executions>

        <configuration>

          <ignoreMissingFile>false</ignoreMissingFile>

          <file>${basedir}/target/javascript/bin/js-debug/index.html</file>

          <replacements>

            <replacement>

              <token><![CDATA[((goog\.addDependency)(.)*)(\.js)]]></token>

              <value><![CDATA[$1.js?v=${timestamp}]]></value>

            </replacement>

            <replacement>

              <token><![CDATA[App.css]]></token>

              <value><![CDATA[App.css?v=${timestamp}]]></value>

            </replacement>

          </replacements>

        </configuration>

      </plugin>

 

 

 

From: Carlos Rovira <[hidden email]> 
Sent: Thursday, January 14, 2021 1:27 AM
To: [hidden email]
Subject: Re: [EXTERNAL] CSS & JS file versioning

 

Thanks Brian,

 

very useful!

 

Not related, but as well useful, I use maven's build timestamp with defines to get it in AS3 in the following way:

 

 

Best,

 

Carlos

 

El mar, 12 ene 2021 a las 19:01, Brian Raymes (<[hidden email]>) escribió:

As others have stated, there are other ways to do this. Here is how I’m doing it with maven:

 

In my case, I’m currently using a timestamp to try to avoid caching. Feel free to replace with a version, etc.

 

This will update the template and build time.

 

  <properties>

    <timestamp>${maven.build.timestamp}</timestamp>

  </properties>

 

 

      <plugin>

        <groupId>com.google.code.maven-replacer-plugin</groupId>

        <artifactId>replacer</artifactId>

        <version>1.5.3</version>

        <executions>

          <execution>

            <phase>package</phase>

            <goals>

              <goal>replace</goal>

            </goals>

          </execution>

        </executions>

        <configuration>

          <ignoreMissingFile>false</ignoreMissingFile>

          <file>${basedir}/target/javascript/bin/js-debug/index.html</file>

          <replacements>

            <replacement>

              <token><![CDATA[App.js]]></token>

              <value><![CDATA[App.js?v=${timestamp}]]></value>

            </replacement>

            <replacement>

              <token><![CDATA[App.css]]></token>

              <value><![CDATA[App.css?v=${timestamp}]]></value>

            </replacement>

          </replacements>

        </configuration>

      </plugin>

 

Brian

 

From: lol lol <[hidden email]> 
Sent: Tuesday, January 12, 2021 1:47 AM
To: [hidden email]
Subject: [EXTERNAL] CSS & JS file versioning

 

Hi All,

 

Is there any possibility defined that lets me define my own placeholders in the html-template?

For example im using an html template with the following line

 

    <link rel="stylesheet" type="text/css" href="${application}.css">

 

Is there anything helpful already existing in the compiler so I can add a version to my css like so:

 

href="${application}?v=12345678" />

 

Thank!


 

-- 

Carlos Rovira

Apache Member & Apache Royale PMC

Apache Software Foundation