Jump to content

Where is the best place for adding a small js snippets?


xezus

Recommended Posts

Hi,

 

I am building my first theme and I am adding small js codes for diffrent parts of the theme, but I don't know where is the best place to put them because of performance. I put them into new created separated js, but I don't know if this is the best way to do that. Is here something like global.css for js?

Link to comment
Share on other sites

Hi xezus,

 

I am currently fixing themes with js problems.

If I made a theme, I would also make a real small module that would only load js at the good time in hookHeader.

 

This way you can use Prestashop, addJs, addJquery, addJqueryPlugin, addCss.

Prestashop will then work to load only one time each js you need.

 

I am fixing theme where several jquery,easing and plugin version are loaded without care.Mixing minified version, with not minified and even older version.

 

Making a module will also permit to ask your customer for settings.

 

Regards

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...