Now I got it. The name in addCssBundle(...) can be any string and can be used to 'hide' the internal name. Since the fonts paths are calcuated relative to the CSS file my browser will calculate and wrong path.

Thank you very much! Without you I wouldn't have been able to figure this out.

Bye

Oliver

Am 04.12.13 17:32, schrieb Martin Grigorov:
right.
you need to use "css/" in
getResourceBundles().addCssBundle(*Bootstrap3Reference*.class,
                                            "*css/*bootstrap.css", new
Bootstrap3Reference());


it is all about tuning :-)

On Wed, Dec 4, 2013 at 5:26 PM, Oliver B. Fischer <[email protected]>wrote:

Hi Martin,

I updated it and changed it as you suggested. But the problem remains.

bootstrap.css is fetched via /bs3test/wicket/resource/com.
profitbricks.wicket.bootstrap.resources.example.bundle.
Bootstrap3Reference/bootstrap-ver-1386173958000.css

But the fonts are fetched via

/bs3test/wicket/resource/fonts/glyphicons-halflings-regular.woff

Oliver

Am 04.12.13 15:41, schrieb Martin Grigorov:

Hi Oliver,

The problem is at
https://bitbucket.org/obfischer/wicket-bootstrap-resources/src/
6e1642e4990e92a228a91bb5b8147b49fced00c0/example/src/main/
java/com/profitbricks/wicket/bootstrap/resources/example/
ExampleApplication.java?at=master#cl-44

Earlier I asked:

Do you use Wicket bundle (several CSS files combined into one) by chance
?
It would break if the bundle doesn't use Bootstrap3Reference.class (or

another class in the same package) as a scope.

Here you set ExampleApplication.class as scope for the bundle. The effect
from this is that Wicket will create url like:

/wicket/resource/com.profitbricks.wicket.bootstrap.resources.example.
ExampleApplication/css/bootstrap(-HASH).css

and since the combined url contains the "url(../font/...) code the browser
will make a request to:
/wicket/resource/com.profitbricks.wicket.bootstrap.resources.example.
ExampleApplication/font/glyphfont-....css

A simple solution is to use Bootstrap3Reference.class as a scope:

getResourceBundles().addCssBundle(*Bootstrap3Reference*.class,

                                            "bootstrap.css",
                                            new Bootstrap3Reference());




No need to override getMinifiedName() (
https://bitbucket.org/obfischer/wicket-bootstrap-resources/src/
6e1642e4990e92a228a91bb5b8147b49fced00c0/example/src/main/
java/com/profitbricks/wicket/bootstrap/resources/example/
bundle/Bootstrap3Reference.java?at=master#cl-26
)
Wicket does the same for you.


On Wed, Dec 4, 2013 at 3:28 PM, Oliver B. Fischer <[email protected]
wrote:

  Hi Martin,

I think the problem is how I specify the bootstrap-theme.css theme as a
dependency of bootstrap.css.

I put my example online at https://bitbucket.org/
obfischer/wicket-bootstrap-resources/src/6e1642e4990e92a228a91bb5b8147b
49fced00c0/example/src/main/java/com/profitbricks/wicket/
bootstrap/resources/example/bundle/Bootstrap3Reference.java?at=master

May you can have a look at it?

Bye,

Oliver

Am 04.12.13 14:51, schrieb Martin Grigorov:

   Hi Oliver,


There is no such central class that maps all resources.
You can use any class as a scope for resources. Just make sure the
resources are in the same folder as the scope class.
Example:
- if the scope class is com.example.package.MyClass
- if the resource path is: css/some.css
- then Wicket will try to load some.css from
/wicket/resource/com.example.package.MyClass/css/some.css

- if some.css contains: url (../font/some.woff)
- then the browser will calculate its absolute url to:
/wicket/resource/com.example.package.MyClass/font/some.woff
- so you have to make sure that font/ folder resides next to css/ in the
classpath

This is how it works.

You can still use the web folder, i.e. create css/ and font/ folders
next
to WEB-INF. This works as with any other Servlet based application.
In your .html you can use <link href="css/some.css"/> to load it in a
page.

The benefit of using Wicket resource references is that:
- you can load different resources depending on the user agent's locale,
or
session style/variation
- you can use dependency management - one resource may depend on several
other. You do "response.render(headerItem)" and wicket makes sure that
all
its dependencies are rendered too
- resource bundles - i.e. to combine several CSS files into one to save
network requests
...

For more consult with
http://wicket.apache.org/guide/guide/single.html#chapter14_4

I'll need more information/code to be able to help you more.

On Wed, Dec 4, 2013 at 2:34 PM, Oliver B. Fischer <
[email protected]

wrote:


   Hi Martin,


is there any ready resource class that simply maps all resource
requests
to a package including relative paths?

Such a simple task takes already too much time. Putting all file in the
WEB-INF folder would take me 10 minutes...

BTW, Wicket is great and powerfull and you can build some simple pages
quite fast. But if you need something more complicated you are
confronted
with a lot of classes and you must understand all the details. And this
does not pay off unless you will build many different applications...

Am 04.12.13 13:45, schrieb Oliver B. Fischer:

    Hi Martin,


I think I will try to write a custom package resource...

BYe,

Oliver

Am 04.12.13 13:23, schrieb Martin Grigorov:

   On Wed, Dec 4, 2013 at 12:11 PM, Oliver B. Fischer

<[email protected]>wrote:

    Hi,


it is there. The CSS as bundle is referenced via

http://localhost:8080/bs3test/wicket/resource/com.
profitbricks.wicket.bootstrap.resources.example.bundle.
Bootstrap3Reference/dist/css/bootstrap-theme-ver-1386155341000.css

But the fonts via

http://localhost:8080/bs3test/wicket/resource/fonts/
glyphicons-halflings-regular.woff



There is something wrong here.
A relative url like
     ../fonts/glyphicons-halflings-regular.eot?#iefix
should be calculated to
http://localhost:8080/bs3test/wicket/resource/com.
profitbricks.wicket.bootstrap.resources.example.bundle.
Bootstrap3Reference/dist

/fonts/glyphicons-halflings-regular.eot?#iefix

Do you use Wicket bundle (several CSS files combined into one) by
chance ?
It would break if the bundle doesn't use Bootstrap3Reference.class
(or
another class in the same package) as a scope.




  I know that the problem that the fonts referenced directly from the
CSS
files. But how can I handle that?

Viele Grüße

Oliver


Am 04.12.13 12:03, schrieb Martin Grigorov:

     Hi,


  Just make sure the font/ folder is next to the css/ folder in your
file
structure.



On Wed, Dec 4, 2013 at 11:59 AM, Oliver B. Fischer
<[email protected]

   wrote:



      Hi,


  I would like to include all Bootstrap 3 resources via resources
references. I managed to in include all CSS files by extending
CssResourceReference and specifying a list of dependencies
(getDependencies()).

But how can I include the fonts provided by Bootstrap? The fonts
are
referenced directly in the CSS files via

src: url('../fonts/glyphicons-halflings-regular.eot?#iefix')
format('embedded-opentype'),

How can I reference these fonts?

Bye,

Oliver

------------------------------------------------------------
---------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




     ------------------------------------------------------------

---------

  To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




    ------------------------------------------------------------
---------

To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


   ------------------------------------------------------------
---------

To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




  ---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to