You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by lucast <lu...@hotmail.com> on 2017/07/31 09:39:42 UTC
using CssResourceReference for css file that lives in webapp
Dear Forum,
I'm implementing a base wicket page where I load all of my CSS and
javascript.
I'm loading files from java class by using
Is there a way to load a css file that lives under the webapp folder
directly from the java class?
At the moment, I'm using
response_.render( CssHeaderItem.forReference(new
CssResourceReference(WicketBasePage.class, "mcc-style.css" ) ) );
where mcc-style.css lives alongside my java class, and inside of the
mcc-style.css, I have placed a very long reference to the css file that
lives under webapp:
Thanks in advance,
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/using-CssResourceReference-for-css-file-that-lives-in-webapp-tp4678358.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: using CssResourceReference for css file that lives in webapp
Posted by Andrea Del Bene <an...@gmail.com>.
At the moment I think Maxim's approach is the best possible. I will try to
find a way to improve the overall mechanism.
On Thu, Aug 3, 2017 at 9:49 AM, Andrea Del Bene <an...@gmail.com>
wrote:
> I will try yo have a look at this today.
>
> Thank you!
>
> On Thu, Aug 3, 2017 at 9:45 AM, Maxim Solodovnik <so...@gmail.com>
> wrote:
>
>> Currently using this approach:
>>
>> final String suffix = DEVELOPMENT ==
>> getApplication().getConfigurationType() ? "" : ".min";
>> response.render(CssHeaderItem.forUrl(String.format("css/theme%s.css",
>> suffix)));
>>
>>
>> On Thu, Aug 3, 2017 at 2:40 PM, lucast <lu...@hotmail.com> wrote:
>>
>> > I'd like to second Maxim on this.
>> > I am loading font files from the css file, and using
>> > ContextRelativeResourceReference did not work.
>> >
>> > I did not post my findings since I presumed it must have been something
>> I
>> > did wrong, or that it didn't work due to lack of understanding on my
>> part.
>> >
>> > Kind regards,
>> > Lucas
>> >
>> > --
>> > View this message in context: http://apache-wicket.1842946.
>> > n4.nabble.com/using-CssResourceReference-for-css-
>> > file-that-lives-in-webapp-tp4678358p4678413.html
>> > Sent from the Users forum mailing list archive at Nabble.com.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>>
>> --
>> WBR
>> Maxim aka solomax
>>
>
>
Re: using CssResourceReference for css file that lives in webapp
Posted by Andrea Del Bene <an...@gmail.com>.
I will try yo have a look at this today.
Thank you!
On Thu, Aug 3, 2017 at 9:45 AM, Maxim Solodovnik <so...@gmail.com>
wrote:
> Currently using this approach:
>
> final String suffix = DEVELOPMENT ==
> getApplication().getConfigurationType() ? "" : ".min";
> response.render(CssHeaderItem.forUrl(String.format("css/theme%s.css",
> suffix)));
>
>
> On Thu, Aug 3, 2017 at 2:40 PM, lucast <lu...@hotmail.com> wrote:
>
> > I'd like to second Maxim on this.
> > I am loading font files from the css file, and using
> > ContextRelativeResourceReference did not work.
> >
> > I did not post my findings since I presumed it must have been something I
> > did wrong, or that it didn't work due to lack of understanding on my
> part.
> >
> > Kind regards,
> > Lucas
> >
> > --
> > View this message in context: http://apache-wicket.1842946.
> > n4.nabble.com/using-CssResourceReference-for-css-
> > file-that-lives-in-webapp-tp4678358p4678413.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> WBR
> Maxim aka solomax
>
Re: using CssResourceReference for css file that lives in webapp
Posted by Maxim Solodovnik <so...@gmail.com>.
Currently using this approach:
final String suffix = DEVELOPMENT ==
getApplication().getConfigurationType() ? "" : ".min";
response.render(CssHeaderItem.forUrl(String.format("css/theme%s.css",
suffix)));
On Thu, Aug 3, 2017 at 2:40 PM, lucast <lu...@hotmail.com> wrote:
> I'd like to second Maxim on this.
> I am loading font files from the css file, and using
> ContextRelativeResourceReference did not work.
>
> I did not post my findings since I presumed it must have been something I
> did wrong, or that it didn't work due to lack of understanding on my part.
>
> Kind regards,
> Lucas
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/using-CssResourceReference-for-css-
> file-that-lives-in-webapp-tp4678358p4678413.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
WBR
Maxim aka solomax
Re: using CssResourceReference for css file that lives in webapp
Posted by lucast <lu...@hotmail.com>.
I'd like to second Maxim on this.
I am loading font files from the css file, and using
ContextRelativeResourceReference did not work.
I did not post my findings since I presumed it must have been something I
did wrong, or that it didn't work due to lack of understanding on my part.
Kind regards,
Lucas
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/using-CssResourceReference-for-css-file-that-lives-in-webapp-tp4678358p4678413.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: using CssResourceReference for css file that lives in webapp
Posted by Maxim Solodovnik <so...@gmail.com>.
Hello Andrea,
i just have tried to use ContextRelativeResourceReference
The CSS is being loaded with minification which is great
But unfortunately images located in css folder are not being found :(
example
/css/theme.css
background-image:url(images/image1.png)
/css/images/image1.png
so it is not very useful right now :(
On Mon, Jul 31, 2017 at 7:48 PM, Andrea Del Bene <an...@gmail.com>
wrote:
> I was about to suggest the same classes :-)
>
> On Mon, Jul 31, 2017 at 1:08 PM, Vit Rozkovec <ro...@email.cz>
> wrote:
>
> > Hi,
> > have a look at those classes:
> >
> > ContextRelativeResource
> > ContextRelativeResourceReference
> >
> > Vit
> >
> >
> > On 07/31/2017 01:01 PM, lucast wrote:
> >
> >> Thank you, Maxim.
> >>
> >> Since I am managing all css files and js files form my java class, I was
> >> wondering if there is an equivalent to the HTML of <link
> rel="stylesheet"
> >> href="css/style.css" ... that one could use from the java class.
> >>
> >> The only motivation is to try to manage as much as I can from the class,
> >> and
> >> keep the HMTL to a bare minimum.
> >>
> >> I can have a css file that lives alongside the java class, I just
> thought
> >> that it would be nice to have all css files under a single location,
> under
> >> webapp file. However, this is more of a Would-Like-To-Have than anything
> >> else.
> >>
> >> Thanks once more,
> >>
> >> --
> >> View this message in context: http://apache-wicket.1842946.n
> >> 4.nabble.com/using-CssResourceReference-for-css-file-that-
> >> lives-in-webapp-tp4678358p4678360.html
> >> Sent from the Users forum mailing list archive at Nabble.com.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
--
WBR
Maxim aka solomax
Re: using CssResourceReference for css file that lives in webapp
Posted by Andrea Del Bene <an...@gmail.com>.
I was about to suggest the same classes :-)
On Mon, Jul 31, 2017 at 1:08 PM, Vit Rozkovec <ro...@email.cz> wrote:
> Hi,
> have a look at those classes:
>
> ContextRelativeResource
> ContextRelativeResourceReference
>
> Vit
>
>
> On 07/31/2017 01:01 PM, lucast wrote:
>
>> Thank you, Maxim.
>>
>> Since I am managing all css files and js files form my java class, I was
>> wondering if there is an equivalent to the HTML of <link rel="stylesheet"
>> href="css/style.css" ... that one could use from the java class.
>>
>> The only motivation is to try to manage as much as I can from the class,
>> and
>> keep the HMTL to a bare minimum.
>>
>> I can have a css file that lives alongside the java class, I just thought
>> that it would be nice to have all css files under a single location, under
>> webapp file. However, this is more of a Would-Like-To-Have than anything
>> else.
>>
>> Thanks once more,
>>
>> --
>> View this message in context: http://apache-wicket.1842946.n
>> 4.nabble.com/using-CssResourceReference-for-css-file-that-
>> lives-in-webapp-tp4678358p4678360.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: using CssResourceReference for css file that lives in webapp
Posted by Vit Rozkovec <ro...@email.cz>.
Hi,
have a look at those classes:
ContextRelativeResource
ContextRelativeResourceReference
Vit
On 07/31/2017 01:01 PM, lucast wrote:
> Thank you, Maxim.
>
> Since I am managing all css files and js files form my java class, I was
> wondering if there is an equivalent to the HTML of <link rel="stylesheet"
> href="css/style.css" ... that one could use from the java class.
>
> The only motivation is to try to manage as much as I can from the class, and
> keep the HMTL to a bare minimum.
>
> I can have a css file that lives alongside the java class, I just thought
> that it would be nice to have all css files under a single location, under
> webapp file. However, this is more of a Would-Like-To-Have than anything
> else.
>
> Thanks once more,
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/using-CssResourceReference-for-css-file-that-lives-in-webapp-tp4678358p4678360.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: using CssResourceReference for css file that lives in webapp
Posted by lucast <lu...@hotmail.com>.
Thank you, Maxim.
Since I am managing all css files and js files form my java class, I was
wondering if there is an equivalent to the HTML of <link rel="stylesheet"
href="css/style.css" ... that one could use from the java class.
The only motivation is to try to manage as much as I can from the class, and
keep the HMTL to a bare minimum.
I can have a css file that lives alongside the java class, I just thought
that it would be nice to have all css files under a single location, under
webapp file. However, this is more of a Would-Like-To-Have than anything
else.
Thanks once more,
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/using-CssResourceReference-for-css-file-that-lives-in-webapp-tp4678358p4678360.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: using CssResourceReference for css file that lives in webapp
Posted by Maxim Solodovnik <so...@gmail.com>.
You can include this css in markup instead of java
On Mon, Jul 31, 2017 at 4:39 PM, lucast <lu...@hotmail.com> wrote:
> Dear Forum,
> I'm implementing a base wicket page where I load all of my CSS and
> javascript.
>
> I'm loading files from java class by using
>
>
>
> Is there a way to load a css file that lives under the webapp folder
> directly from the java class?
> At the moment, I'm using
>
> response_.render( CssHeaderItem.forReference(new
> CssResourceReference(WicketBasePage.class, "mcc-style.css" ) ) );
>
> where mcc-style.css lives alongside my java class, and inside of the
> mcc-style.css, I have placed a very long reference to the css file that
> lives under webapp:
>
>
>
> Thanks in advance,
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/using-CssResourceReference-for-css-file-that-lives-in-webapp-tp4678358.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
WBR
Maxim aka solomax
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org