gantry / gantry5

:rocket: Next Generation Template / Theme Framework
http://gantry.org
1.03k stars 205 forks source link

local theme main.js makes gantry not loading it's own main.js with WP 5.1 #2468

Open manuel-84 opened 5 years ago

manuel-84 commented 5 years ago

Seems that the framework is not loading it's main.js file from assets and I don't know why.

simmonsr commented 5 years ago

Did you clear the cache in the Gantry admin? It seems to be loading fine looking at one of our G5 demos on WP 5.1.

manuel-84 commented 5 years ago

Did you clear the cache in the Gantry admin? It seems to be loading fine looking at one of our G5 demos on WP 5.1.

Yes, the cache is cleared and I'm not using cache plugins + I have enabled debug and dev mode

simmonsr commented 5 years ago

Do you have link to your site?

manuel-84 commented 5 years ago

Do you have link to your site?

https://demo.inoke.org/uno/

simmonsr commented 5 years ago

Hmm, strange. I can't seem to replicate, but I will try another site. Is the issue present with a clean Helium RocketLauncher in a subdirectory on your server?

http://gantry.org/downloads#wordpress

Also try selectively disabling any 3rd party plugins on your demo.inoke.org/uno site.

manuel-84 commented 5 years ago

even if I add it manually into the footer, the menu class "g-active" it's not working

manuel-84 commented 5 years ago

Hmm, strange. I can't seem to replicate, but I will try another site. Is the issue present with a clean Helium RocketLauncher in a subdirectory on your server?

my theme is based on hydrogen, if I try with a clean copy of version 5.4.27 it's working

simmonsr commented 5 years ago

I would do Diff then between your theme and the clean copy and see what parts are different.

manuel-84 commented 5 years ago

I would do Diff then between your theme and the clean copy and see what parts are different.

PHP files have the same content, and on the rest nothing interesting. Maybe it's something in the configuration? Or the fact that my theme contains a main.js file too?

I'm using the Before </body> to load Nucleus main.js until I get the problem solved

simmonsr commented 5 years ago

How are you loading the main.js file from your theme? I'll see if I can replicate.

manuel-84 commented 5 years ago

How are you loading the main.js file from your theme? I'll see if I can replicate.

I was using Page Settings > Assets > Javascript > File location: gantry-assets://js/main.js Before body: true

Then I tried also gantry-theme and then using the relative path /uno/wp-content/themes/g5_uno/js/main.js but the result is always that framework main.js is not added automatically.

Is there something in the framework that can block his assets load?

simmonsr commented 5 years ago

So does removing that file resolve the issue then? Please try it as a test.

manuel-84 commented 5 years ago

So does removing that file resolve the issue then? Please try it as a test.

Oh dear, removing mytheme/js/main.js works 🤣 But I'm sure i had this file in other themes too and before I upgrade to latest WP/Gantry it was working fine.

simmonsr commented 5 years ago

Yes, I can confirm this issue on my local. If I rename the file to 'mainer.js' (just an example) it is not an issue. Nevertheless, I have reached out @mahagr and @newkind.

simmonsr commented 5 years ago

This issue goes beyond WordPress, adding a file in the template/theme directory with the same name and similar path as the one in Gantry5 core, it is going to get overwritten (same thing in Joomla / Grav). You will need to use a different name or change the path (such as gantry-assets://js/theme/main.js (works ok)) .

mahagr commented 5 years ago

This is by design allowing you to customize Gantry for your theme if you need to do that. Almost all the files in the Gantry framework are overrideable by the theme by just copying the file over.

manuel-84 commented 5 years ago

can you add this behavior to the documentation? http://docs.gantry.org/gantry5/advanced/file-overrides

because i knew that to override Nucleus engine files we had to put files into a "custom" directory: /wp-content/plugins/gantry5 > THEME_DIR/custom

mahagr commented 5 years ago

Well, basically there are two locations:

THEME_DIR = for theme maintainers THEME_DIR/custom = for theme users

So basically the first location should be used if you're developing your own theme and want the files to be updated on theme update, second location is custom for the site.