Grails Resources plugin, modules and <r: img> for rendering images?
trying to learn the Resources plugin
In my opinion, this helps to identify "resources", such as css and javascript files, and automatically pull them into your gsp when necessary. I understand how to create modules that can then be loaded using tags, etc.
The im part doesn't understand it: http://grails-plugins.github.com/grails-resources/guide/4.%20Using%20resources.html#4.2%20Linking%20to%20images
So, create a module called "images" in Config.groovy as follows:
grails.resources.modules = {
images {
resource url:'/images/view.jpg', attrs:[width: 1280, height:720 , alt: 'my view']
resource url:'/images/breakfast.jpg', attrs:[width: 1280, height:720, alt: 'breakfast']
}
}
Resources are included in the .gsp page in the chapter section as follows:
<head>
<r:require modules="jquery-ui, blueprint"/>
</head>
I know that the resources have been successfully added to the section of the chapter, because when I check the source of the page, I see them there:
<link href="/ResourceTest/static/Aa7jV0N2qZjOz7TLZ9cl5cREIh2y5jJYV0ytn4nQg9r.jpg" rel="shortcut icon" width="1280" height="720" alt="my view" />
<link href="/ResourceTest/static/IpQBSjrYeLDdSUBGbP3jhf6Kkhvu1zV3XRtwWfKOIMn.jpg" rel="shortcut icon" width="1280" height="720" alt="breakfast" />
: ? , , javascript, html-, : " , , ".
? :
<r:img module="images">
<r:img alt="breakfast">
:
<r:img uri="/images/breakfast.jpg">
, r: require. , ?
. , , javascript, jQuery, . : , gsp sitemesh, . HTML- gsp, , . , .
. http://grails-plugins.imtqy.com/grails-resources/ref/Tags/require.html http://grails-plugins.imtqy.com/grails-resources/ref/Tags/layoutResources.html.
, , . , , , , , , . , , require , <r:img>. , - , -. .:)