Location of assets

Jaroslav Ciml <[email protected]>
Newsgroups gmane.comp.java.tapestry.user
Message-ID <[email protected]>
Hi,

I am trying to figure out what is the correct location of assets with Tapestry 5.4 and Maven directory structure.

I will explain how do I understand it. Correct what is wrong please.

From logical point of view, I can think of two types of assets - global and comopnent specific.

A global asset is e.g. a PNG image that is used as a background in various places in the application, i.e. it is referenced in many Tapestry components. Such global assets are called "context assets" in Tapestry.

A component specific asset is say a CSS file that defines style just for the HTML markup generated by one specific Tapestry component. Such component specific assets are called "class path assets" in Tapestry.

Suppose that I have some Tapestry component with CSS file and a global PNG image.

The tml and java files for the component are located in:
src/main/java/com/somecompany/myapp/view/components/MyComponent.java
src/main/resources/com/somecompany/myapp/view/components/MyComponent.tml

And this is the appropriate configuration in web.xml:
<context-param>
  <param-name>tapestry.app-package</param-name>
  <param-value>com.somecompany.myapp.view</param-value>
</context-param>

The global PNG file is located in:
src/main/webapp/images/myimage.png

The CSS file that is related just to MyComponent is located in:
src/main/resources/META-INF/assets/MyComponent.css

and the CSS is imported in MyComponent.java:
@Import(stylesheet = "MyComponent.css")

Do these locations make sense please?

If so, is it possible to reference the global PNG from the component specific CSS?
ul.my-component-menu {
  background-image: url('what_should_be_here/myimage.png');
}

Thanks.
Jarda
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.