page_theme.php

Permalink
I need some guidance with regard to page_theme.php and assets in C58.4

Here are a few references that we have used to get a mind-meld with this thing, we have a lot more, but these should suffice for this discussion.
Referrence1:https://documentation.concrete5.org/developers/pages-themes/designin...
Referrence2: "Clonemental Theme" page_theme.php (using it as a template to impiment in a new theme we are concretalizing)

We think we understand the difference between requiring and providing assets, if I am correct, essentially:
a) providing assets means my theme will provide the asset (for the frontend???) ex: bootstrap, js etc.,
b) requiring assets means I want C5 to provide the BS, JS etc. (for the backend???).

In Andrew's screen cast (referrence1) there is a piece of code as follows:

public function registerAssets()
{
line1 $this->providesAsset('javascript', 'bootstrap/*');
line2 $this->providesAsset('css', 'bootstrap/*');
line3 $this->providesAsset('css', 'blocks/form');
line4 $this->providesAsset('css', 'core/frontend/*');
line5 $this->requireAsset('javascript', 'jquery');
}

I get what the objective is, my question is:
If I am (via theme) providing the assets, what is the purpose of Line5? My theme requires jquery, so how do I allow both to be in use - or nuke one of them, see SUMMARY below...

In Referrence2, there is this piece of code:
public function registerAssets()
{
//$this->providesAsset('javascript', 'bootstrap/*');
$this->providesAsset('css', 'bootstrap/*');
$this->providesAsset('css', 'blocks/form');
$this->providesAsset('css', 'blocks/social_links');
$this->providesAsset('css', 'blocks/share_this_page');
$this->providesAsset('css', 'blocks/feature');
$this->providesAsset('css', 'blocks/testimonial');
$this->providesAsset('css', 'blocks/date_navigation');
$this->providesAsset('css', 'blocks/topic_list');
$this->providesAsset('css', 'blocks/faq');
$this->providesAsset('css', 'blocks/tags');
$this->providesAsset('css', 'core/frontend/*');
$this->providesAsset('css', 'blocks/feature/templates/hover_description');

$this->providesAsset('css', 'blocks/event_list');

$this->requireAsset('css', 'font-awesome');
$this->requireAsset('javascript', 'jquery');
$this->requireAsset('javascript', 'picturefill');
$this->requireAsset('javascript-conditional', 'html5-shiv');
$this->requireAsset('javascript-conditional', 'respond');
}
SUMMARY:
========
Of course, there are some items above that I don't need (I beleive), so here are my questions:

1) If I wanted to "provide" access to my own "CSS", how would I do this?
2) Why would one not GROUP (if this can be done) Require and Provide Separately?
3) Is the order of provide/require important,
4) Last, my theme provides jquery and C5 provides jquery I get (I believe) collisions, which is what I want to avoid.
If I remove jquery (as Andrew did in his screencast) my theme fails, but the backend seems to work.
If I put my theme's jquery back in (along with C5 jquery) everything grinds to a halt when I add a Content Block (for example),
-->> Here is my question (loaded of course) what do I do to prevent this?

I know it's a lot of info and so as not to waste everyone's time, we have spent a week going over everything we can find.
We are really trying to get our heads around this and many of the Links and Docs for C5 are either broken or refer to previous versions.

Thanks for any insight and guidance.

 
blinkdesign replied on at Permalink Best Answer Reply
blinkdesign
You might have a look at this:
Page Them Explained with Comments
https://github.com/lewismcarey/concrete5.7-page_theme.php/blob/maste...
barbedwire replied on at Permalink Reply
blinkdesign:
=========

This is absolutely stellar. I thought we had found all the relevant docs, obviously missed this.

A most concise answer and on point, Thank you.

At this point, we have confirmed the correct resources are being loaded and checked the Java Console and see no errors.

The only issue we have is when adding content, specifically we can add any content we want with the exception of a "Content Block". the slider indicator (blue bar at top) goes from left to right and then hangs.

We'll have to do some more verification obviously, could be something as simple as a css issue. If you have a thoughts on this, they would be appreciated.

Again, Thank You.
blinkdesign replied on at Permalink Reply
blinkdesign
Your issue is most likely, that there is a Javascript conflict. Assets are either loaded twice or not loaded at all. Check the console to find out.
barbedwire replied on at Permalink Reply
Embarrassment time šŸ˜³

For some dumb reason I commented out the script that loads query instead of deleting it!

I know, dumb rookie mistake.

So with that out of the way, everything works like a charm. My only issue is the NAG (nav) bar not using my styles and classes, but there are plenty of good links out there.

We’ll play with them and see what happens.

Again, many thanks.