Jump to content

Recommended Posts

Hello,

 

How to properly add javaScripts and styles in prestashop ?

 

I want to add a stylesheet that loads after everything else ? how can i do that ? 

 

I know i can go to header.tpl file and add it after

{if isset($css_files)}
...
{/if}
But this way it won't be included in ccc compiled stylesheet.
 
same with script files ?
 
I think the most basic thing for theme development is being able to load your desired scripts and stylesheets where you need them and in order you need them  but i didn't find anything about this on documentation ?
 
Am i missing something too obvious ?
 
 
Link to comment
Share on other sites

If you are using 1.6 version you can add scripts and stylesheets by placing files in themes/your_theme/js/autoload, or themes/your_theme/css/autoload and check default-bootstrap theme and how  js files are loaded. Because if order matters just rename them with numbers in front.

 

Other solution that people use is to make  module like El Patron said, or to override FrontController setMedia function.

  • Like 1
Link to comment
Share on other sites

Thanks for Autoload tip that's cool and useful but it still won't solve my problem of making sure that my styles load as the last stylesheet after everything else added by modules and other controllers. 

 

How does ccc work ? Is there anyway we can add a css file to the end of css array right before ccc starts combining the css files ?

Any hook or something ?

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...