Jump to content

[SOLVED] CSS and child theme


jmm.it

Recommended Posts

Hi,

I'm experiencing some stylesheet problems with a child theme on a commercial theme, 1.7.6.5 installation.

I have a good knowledge of PS 1.6, some years of work, and I'm moving my first steps with 1.7.

I've always found the module/theme styling/overriding process to be very stressful in 1.6, in particular when updates occurred. 

So I had really high expectations about the child theme introduction, but now I'm finding it hard to understand how to style/override a template when the child theme is activated.

These are the steps I've taken:

- Installed commercial theme and all dependencies (everything works and can be styled through FTP);

- Created, installed and activated child theme with parent assets correctly linked (site looks and works fine);

- Added new stylesheet in child theme theme.yml, with custom name (child_custom.css) and 999 priority, positioned in assets/css in the child theme dir, as the parent theme has some style applied in custom.css, therefore it can't be used in the child theme (here I have issues, see below);

- Created copies of module template files I want to modify, with the correct directory structure, modified them (issues here as well, see below);

All I want to achieve is having a place (the child theme) to store just the modifications to the parent theme and modules, so that I can upgrade them with no fuss.

But what happens is that styles in child_custom.css and in the module templates stylesheets aren't applied when I upload the modifications through an FTP client. After uploading the file, the site shows a cached file of a previous version of that stylesheet. It seems to be refreshed only at the moment the child theme is activated, so it is necessary to change theme in the backend, switch back to the child theme, then the last version uploaded is shown. This way it's very unpractical and difficult to test/adjust several lines of code, even if they are previewed using the browser development tools. 

This "caching" doesn't happen with child theme tpl files, that correctly show the modifications just after they are uploaded.

Am I missing something? Or is the child theme supposed to work in a different way, and it's not the proper instrument to reach my goal?

Thanks for your help.

EF

 

 

 

Link to comment
Share on other sites

As I wrote up here, the parent theme uses custom.css to define some styles. If I use a custom.css it in the child theme, the parent will be ignored and I will have to copy all the styles in the child losing upgrades.

Actually, I tried to move the parent custom.css to the child dir and use it, but I still have the same caching problem mentioned: the modifications to this file uploaded via FTP are shown on the site only after changing theme and reactivating the child.

 

 

Link to comment
Share on other sites

  • jmm.it changed the title to [SOLVED] CSS and child theme
  • 2 months later...
On 4/23/2020 at 10:35 PM, jmm.it said:

Installed commercial theme and all dependencies (everything works and can be styled through FTP);

- Created, installed and activated child theme with parent assets correctly linked (site looks and works fine);

Sorry,

Do you give me an example of this? 

My parent assets don't load correctly.

 

Thanks

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