Back to this one...

In my AppModule I did this:

    public static void
contributeClasspathAssetAliasManager(MappedConfiguration<String, String>
configuration) {
        configuration.add("css/1.6", "com/mycompany/myapp/components/css");
    }

In my Layout template (the only place using the css to be versioned):

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

which is located at

    src/main/resources/com/mycompany/myapp/components/Layout.tml

and then I had to move my css from

    src/main/webapp/css/my.css

to

    src/main/resources/com/mycompany/myapp/components/css/my.css

With this in place, it works. That means changing the version number in
AppModule and changing the css, the browser loads the new version.

What bothers me is the location of the css. Is there a way I can move it
directly to src/main/resources/css? I tried several configurations, but none
worked.

Thanks,
Borut


2009/5/25 Christian Senk <senk.christ...@googlemail.com>

> Sorry Borut, doesn't pay attention at the tapestry version ^.^
> Mayby this can help you, look at the end of this page:
>
> http://tapestry.apache.org/tapestry5/cookbook/lib.html
>
> there is a short chapter about versioning assets :)
> I think this way already exists in 5.0.18
>
> Borut Bolčina schrieb:
>
>  Thanks Christian but I am using T 5.0.18 and
>> SymbolConstants.APPLICATION_VERSION is not available. Upgrade to 5.1 is
>> not
>> an option as we are using tapestry-spring-security which is not yet
>> compatible with 5.1
>>
>> So, how to do it in 5.0.18?
>>
>> -Borut
>>
>> 2009/5/25 Christian Senk <senk.christ...@googlemail.com>
>>
>>
>>
>>> You put this line into the contribution method for the Application
>>> Defaults
>>> in your
>>> Tapestry-module. For example:
>>>
>>> public static void contributeApplicationDefaults(
>>>          MappedConfiguration<String, String> configuration) {
>>>      configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en,de");
>>>      configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
>>>            //Application Version
>>>      configuration.add(SymbolConstants.APPLICATION_VERSION, "0.0.7");
>>>  }
>>>
>>> And thats all what you have to do. Tapestry automatically does everything
>>> for you.
>>> If you don't have this line until now, tapestry replaced the version in
>>> the
>>> path with
>>> a generated hex-string.
>>>
>>> An example path could look like:
>>>
>>> /app/assets/ctx/0.0.7/styles/style.css
>>>
>>> In your case, you have the following:
>>>
>>> src/main/webapp/css/my.css
>>>
>>> and with the versioning line in the browser it looks like:
>>>
>>> /app/assets/ctx/0.0.7/css/my.css
>>>
>>> you don't have to create folders for that. And don't bother
>>> about your templates "asset:context" do all this stuff automatically
>>> for you.
>>>
>>> Hope i explained it good enough ^.^
>>>
>>> Borut Bolčina schrieb:
>>>
>>>  Hello,
>>>
>>>
>>>> 2009/5/25 Christian Senk <senk.christ...@googlemail.com>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Hi,
>>>>>
>>>>> you may increment your build number by one, and use the Application
>>>>> version
>>>>> symbol.
>>>>>
>>>>> configuration.add(SymbolConstants.APPLICATION_VERSION, "0.0.7");
>>>>>
>>>>>
>>>>>
>>>>>
>>>> Where do I put this line?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> the version is part of the path to the assets.
>>>>>
>>>>>
>>>>>
>>>>>
>>>> So, if I now have
>>>>
>>>>   src/main/webapp/css/my.css
>>>>
>>>> I must create
>>>>
>>>>   src/main/webapp/css/0.0.7/my.css
>>>>
>>>> Is this correct?
>>>>
>>>> What about href in my layout component? It looks like this now:
>>>>
>>>>       <link rel="stylesheet" type="text/css"
>>>> href="${asset:context:css/my.css}" />
>>>>
>>>> I want to avoid modifying templates and code in multiple places when css
>>>> changes. Is this possible?
>>>>
>>>> Thanks,
>>>> Borut
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Borut Bolčina schrieb:
>>>>>
>>>>>  Hello,
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> we have a T5.0.18 in production. Now I want to "deliver" changed CSS
>>>>>> to
>>>>>> all
>>>>>> existing users, so there must be a way of versioning CSS and other
>>>>>> assests.
>>>>>>
>>>>>> There is nothing at
>>>>>> http://tapestry.apache.org/tapestry5/guide/assets.htmlabout
>>>>>> versioning, although I think this functionality exists. Can someone
>>>>>> point me to an example of how to organize and configure my app to
>>>>>> handle
>>>>>> versioned assets? Do I have to create different directories etc?
>>>>>>
>>>>>> -Borut
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to