In registerAssets(), question: When to use $this->providesAsset VS $this->requireAsset

Regarding the excellent documentation here...

So if I'm converting a theme that comes with assets that are also in core, I understand the concept fine, but when should I use the themes asssets and when should I use what comes with core?

This is the example given

public function registerAssets()
    $this->providesAsset('javascript', 'bootstrap/*');
    $this->providesAsset('css', 'bootstrap/*');
    $this->providesAsset('css', 'blocks/form');
    $this->providesAsset('css', 'core/frontend/*');
    $this->requireAsset('javascript', 'jquery');

I just don't understand the why the choices were made, for example, to use the themes assets via
$this->providesAsset('javascript', 'bootstrap/*');

and to use the core assets via
$this->requireAsset  for ('javascript', 'jquery');

I mean, why use the themes bootstrap, but not jquery? Or visa-versa?
Any clarification is appreciated

View Replies:
MrKDilkington replied on at Permalink Reply
Hi OKDnet,

Someone asked a similar question last week about using core Bootstrap in a theme.

In answering the question, I tried requiring all the CSS and JavaScript assets on the internal assets page. Basically all of them could be used in a theme except for the full Bootstrap CSS (it is scoped to .ccm-ui).
$this->providesAsset('javascript', 'bootstrap/*');

I believe Bootstrap JavaScript is provided because concrete5 only uses part of the full list of available JavaScript that comes with Bootstrap.

Core Bootstrap JavaScript assets - dropdown, tooltip, popover, alert, button, transition

Bootstrap JavaScript not in the core - modal, scrollspy, tab, collapse, carousel, affix

Regarding jQuery, I am not sure. I think with something like that, the most important thing is that it is registered, whether you are providing it or requiring it. Also, some may want to load jQuery from a specific CDN like Google or need an updated version that hasn't been included in concrete5 yet.