tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jaroslav Ciml <jaroslav.c...@jpower8.cz>
Subject Location of assets
Date Fri, 24 Feb 2017 11:59:01 GMT
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Mime
View raw message