Closed ErinPo closed 6 years ago
Not sure if this is related but I installed 0.3.9 and jQuery is not being loaded.
Uncaught ReferenceError: jQuery is not defined at child-theme.min.js:1
No, the child theme loads its own /src to keep at as much as possible away from the parent theme. It is now part of the repo because people should be able to compile sass into css without running "npm install" first. There are a lot of people who don´t work with terminals and using GUI´s like Scout App to compile there CSS. Without the /src folder included I have to answere a lot of mails like "cant compile SASS because there are no sources." To avoid this Ive re-add the folder to avoid this.
@eversionsystems: Pls compare your child themes functions.php with this file: https://github.com/holger1411/understrap-child/blob/master/functions.php
In a former version UnderStrap deregister the WP core jQuery version and loads a newer version by default to avoid comaptibility issues with the latest BS4 Beta2. But wordpress.org did not allow this. So I switched back. If your functions.php still tries to load a custom jQuery version (which ist not included anymore) yopu will get such a error message.
Ok thanks for the explanation. My functions file is identical to the one you posted so I ended up just adding in a jQuery version into the gulp task 'scripts' to add it into the footer.
Understood, so are you going to keep the sources in sync between the child and parent themes at all times?
I have this same error "Uncaught ReferenceError: jQuery is not defined at child-theme.min.js:1". @eversionsystems Can you clarify what you did in the gulp task 'scripts' to get it working?
@denislam just add a reference to a version of jQuery before Bootstrap in the basePaths directory which is located in understrap-child/js.
gulp.task('scripts', function() {
var scripts = [
basePaths.dev + 'js/jquery.min.js',
// Start - All BS4 stuff
basePaths.dev + 'js/bootstrap4/bootstrap.js',
// End - All BS4 stuff
basePaths.dev + 'js/skip-link-focus-fix.js'
];
@eversionsystems isn't that then loading jQuery twice - once via functions.php and then again compiled into the main child-theme.min.js?
@axlright I'm not sure of other people's scenarios but for me it wasn't loading any version of jQuery using version 0.3.9. I couldn't see it in the child-theme.min.js and I was getting a console error saying jQuery was missing.
The child theme deregister all scripts from parent and loads its own stack. jQuery is loaded here: https://github.com/holger1411/understrap-child/blob/master/functions.php#L19
Check if you find this line in your version, too
In an earlier version I tried to load jQuery as dependency and not from WP core, but it was rejected by the WordPress.org theme reviewer team for the parent theme. So I have to switch it back.
So would there be any future issue if I removed the src/ and sass/assets/ directories from my child theme and instead referenced the required files directly in the parent theme and node_modules?
Everything should be solved/answered by now if i´m not all wrong. Please feel free to reopen if any issue persists, okay?
I noticed that version 0.3.9 now includes the /src folder which was previously only in the parent theme. Wasn't the idea to get the sources from the parent theme?