You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Nick Pratt <nb...@gmail.com> on 2012/12/07 00:51:02 UTC

Conditional JS includes

I currently have a single javascript file in a custom Behavior that Id like
to conditionally include sections of depending on provided user options.

Whats the best way to achieve this?

Split the single file in to, say 3 separate JS files and then conditionally
include them in Java during the renderHead() of my Behavior? Is there a
better way?


Nick

Re: Conditional JS includes

Posted by Jeremy Thomerson <je...@wickettraining.com>.
You could use if/else blocks in your text templates.

On Friday, December 7, 2012, Nick Pratt wrote:

> Do TextTemplate's aggregate, and can that aggregate be provided as a single
> Resource?
>
> N
>
> On Fri, Dec 7, 2012 at 3:28 AM, Martin Grigorov <mgrigorov@apache.org<javascript:;>
> >wrote:
>
> > You can also use TextTemplate(s) to construct/concat the JS dynamically.
> >
> >
> > On Fri, Dec 7, 2012 at 12:51 AM, Nick Pratt <nbpratt@gmail.com<javascript:;>>
> wrote:
> >
> > > I currently have a single javascript file in a custom Behavior that Id
> > like
> > > to conditionally include sections of depending on provided user
> options.
> > >
> > > Whats the best way to achieve this?
> > >
> > > Split the single file in to, say 3 separate JS files and then
> > conditionally
> > > include them in Java during the renderHead() of my Behavior? Is there a
> > > better way?
> > >
> > >
> > > Nick
> > >
> >
> >
> >
> > --
> > Martin Grigorov
> > jWeekend
> > Training, Consulting, Development
> > http://jWeekend.com <http://jweekend.com/>
> >
>


-- 
Jeremy Thomerson
http://wickettraining.com
*Need a CMS for Wicket?  Use Brix! http://brixcms.org*

Re: Conditional JS includes

Posted by Nick Pratt <nb...@gmail.com>.
Do TextTemplate's aggregate, and can that aggregate be provided as a single
Resource?

N

On Fri, Dec 7, 2012 at 3:28 AM, Martin Grigorov <mg...@apache.org>wrote:

> You can also use TextTemplate(s) to construct/concat the JS dynamically.
>
>
> On Fri, Dec 7, 2012 at 12:51 AM, Nick Pratt <nb...@gmail.com> wrote:
>
> > I currently have a single javascript file in a custom Behavior that Id
> like
> > to conditionally include sections of depending on provided user options.
> >
> > Whats the best way to achieve this?
> >
> > Split the single file in to, say 3 separate JS files and then
> conditionally
> > include them in Java during the renderHead() of my Behavior? Is there a
> > better way?
> >
> >
> > Nick
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>

Re: Conditional JS includes

Posted by Martin Grigorov <mg...@apache.org>.
You can also use TextTemplate(s) to construct/concat the JS dynamically.


On Fri, Dec 7, 2012 at 12:51 AM, Nick Pratt <nb...@gmail.com> wrote:

> I currently have a single javascript file in a custom Behavior that Id like
> to conditionally include sections of depending on provided user options.
>
> Whats the best way to achieve this?
>
> Split the single file in to, say 3 separate JS files and then conditionally
> include them in Java during the renderHead() of my Behavior? Is there a
> better way?
>
>
> Nick
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>