en Jump to content
  • 0
rtyrtrty

How to add custom CSS file in stylesheets.tpl

Question

4 answers to this question

Recommended Posts

  • 0

I found a page where a spanish guy says that you only need to add it to your assetts/css folder but my custom stylesheets are not loaded.

This is the link: http://stackoverflow.com/questions/43756398/how-do-i-call-custom-css-in-prestashop-1-7

 

[uPDATE]

I also found in the documentation that you have to set up external CSS / JS files within the theme.yml file.

This is the link: http://developers.prestashop.com/themes/assets/index.html#registering-in-themes

 

I have done it this way:

assets:
  css:
    all:
      - id: My custom CSS
        path: assets/css/mycustomstyle.css
        media: all
        priority: 100

But it does not load either. I do not know if it is something with the cache or so. I will keep you updated.

Edited by qroft

Share this post


Link to post
Share on other sites
  • 0

[sOLUTION]

Ok, now this is going to be complicated, but working.

First of all insert your scripts (js and css) as i mentioned above inside your theme.yml

 

Second do what Samo70 says on this forum entry with the cache and CCC in the admin backend:

https://www.prestashop.com/forums/topic/610331-prestashop-1711-how-to-simply-change-background-in-classic-theme-custom-css/

 

ATTENTION PLEASE:

I am new to Prestashop and trying out some things. But what i have read, and in case some of you have NOT read, is the way that 1.7 handles external files.

In other words: if you follow the above steps and then check the HTML code of your website, you won't find your CSS files in there as they are "compressed" into one big file.

If the above steps are done, check your code and search for "stylesheet" and you will find something like stylesheet-339383.css

Open that file and you will see that every CSS file that you have inserted into the YML file, will be in that CSS file.

Share this post


Link to post
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

×

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More