Open magicboo opened 10 years ago
A) images (flags) not working in war mode: see issue "In war the URI to static images in plugins lacks the static URI prefix #78" You can always drop the images under your images directory under web-app then simply update the _language.gsp that was created by the kickstart plugin under views/_menu to use something like this:
<img class="" src="${resource(dir: 'images/flags',file: lang.toString()+'.png')}" />
I have not tried this with a war deployment but in theory it should work. There is one more thing - there is no icon for the english language so if your locale is en_US for example you will not see the image. Several fixes exist - what I did is a simply copied the gb.png and duplicated it as en.png
B) Glyph-icons do not work with the resources plug in 1.2.6, but they do work with 1.2.1 however it has been found that 1.2.1 presents a security risk. To use 1.2.6 you can use this hack: copy the 4 glyph-icons files under web-app/css/fonts then in your main.css file (or whatever css file you happen to be including in your project drop the following lines:
@font-face {
font-family: 'Glyphicons Halflings';
src: url('fonts/glyphicons-halflings-regular.eot');
src: url('fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded- opentype'),
url('fonts/glyphicons-halflings-regular.woff') format('woff'),
url('fonts/glyphicons-halflings-regular.ttf') format('truetype'),
url('fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg');
}
This will make the glyphs work with the 1.2.6 resources plugin. (hehe - although what we are doing this way is kind of circumventing the resources plug in - i.e. we are not using the plug in to include the resources) Please note that the css above provides a url in the form of "fonts/**" what is assumed is that the base directory is /css under your web-app folder.
Disclaimer: These are in no way the only or the best solutions - they simply worked for me.
Hi, thanks for your information.
I am trying to follow your steps to solve Glyph-icons issue as below:
[Update] I want to modify plugin's original content that cause resource issue in bundle-bundle_bootstrap_head.css. But I only find bootstrap.css that contains: @font-face { font-family: 'Glyphicons Halflings'; src: url('../fonts/glyphicons-halflings-regular.eot'); src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') ...... } Wired....so where is the problematic code? @font-face { font-family: 'Glyphicons Halflings'; src: url('resource:/bootstrap/dist/fonts/glyphicons-halflings-regular.eot'); src: url('resource:/bootstrap/dist/fonts/glyphicons-halflings-regular.eot?#iefix')......
Hi, I am no expert here but based on the info above it sounds like you are doing all the right things.
1) I don't think you will be able to get rid of the net::ERR_UNK because the plugin is wired to look for them in a specific place but as we see in your browser console, the files that you put in under css/fonts did get loaded (assuming you are following the example I gave).
2) Its probably the way you have defined the resource dependencies with depends on (my best guess here) - instead of using the depends on could you simply define your fix css file as a stand alone resource and include it with the
3) This I think is generated by the CCSRewrite function of the resources plug in. It does not work because there is no directory under the web-app folder that has /css/resource:/bootstrap/.... remember that the src url here assumes to prefix a 'css/'
@font-face {
font-family: 'Glyphicons Halflings';
src: url('resource:/bootstrap/dist/fonts/glyphicons-halflings-regular.eot');
src: url('resource:/bootstrap/dist/fonts/glyphicons-halflings-regular.eot?#iefix')......
4) you see this because it assumes you will wash it down the resources plugin and the ../ be substituted by the real path that will be /css/static/fonts (something down those lines)
@font-face {
font-family: 'Glyphicons Halflings';
src: url('../fonts/glyphicons-halflings-regular.eot');
src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') ......
}
Either way this is an issue with the resources plugin rather than the Kickstart plugin.
Also if you have security defined make sure you include something like this in your Config.groovy
grails.plugin.springsecurity.controllerAnnotations.staticRules = [
..................
'/**/css/**': ['permitAll'],
..................
]
No matter use defined module that depends on bootstrap & utils or use it standalone
The only thing I make sure is fix-glyphicons appear in rendered source after : <link href="/x/static/bundle-bundle_bootstrap_head.css" type="text/css" rel="stylesheet" media="screen, projection" /> <link href="/x/static/bundle-bundle_bootstrap_utils_head.css" type="text/css" rel="stylesheet" media="screen, projection" /> <link href="/x/static/css/fix-glyphicons.css" type="text/css" rel="stylesheet" media="screen, projection" />
Did anyone come up with a good fix for this?
UPDATE...I found this:
Changing the includes line in config.groovy to add bootstrap fixed it:
grails.resources.adhoc.includes = ['/images/', '/css/', '/js/', '/plugins/', '/bootstrap/**']
I follow the standard process to add the plugin successfully to a brand new project. But when I start the project, error message appear:
...... ERROR resource.ResourceMeta - Resource not found: /images/flags/pt.png ERROR resource.ResourceMeta - Resource not found: /images/flags/ru.png ERROR resource.ResourceMeta - Resource not found: /images/flags/sv.png
And I can't find any "flags" directory in my project's \web-app\images
[Update] It's my fault... I am using GGTS's "Run as > Run on server" to run my Grails project and it seems not combine plugin content in packaged war. So images are lost. When I changed to use "run-app" to run my project, the images were shown correctly. But....glyphicons are not! Still figure out the problem.