ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Jquery scripts in a template file or leave as a file on the server?

October 27, 2010 12:01pm

Subscribe [2]
  • #1 / Oct 27, 2010 12:01pm

    Deisun

    12 posts

    Is there any benefit or disadvantage to having my CSS and my Jquery scripts in EE templates?

    The reason I ask is because I’m including my first Jquery script (simpleModal) and what I did was I created a “scripts” group in EE and made a template called simpleModal which has all the code from simpleModal.
    I was then just going to include that template in my header file using the ee scripts tag. 


    Is this ideal or is it slower than just having the .js file on the server and including it like that?

    I’ve also heard of some people using Global Variables to put their .js scripts in.  What are the benefits of that?

  • #2 / Oct 27, 2010 12:57pm

    Duncan McCall

    46 posts

    I leave my js as files on the server simply because it makes it easier to edit.

    I often use a global variable (or a “header” embedded template) to include stuff like that, again because it makes it easier to update and edit. 

    I never found any advantage to putting js in a template unless you need to run Expression Engine tags inside it.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases