How to add bootstrap cdn or pure.css to a block in concrete5 version 5.6?

162 Views Asked by At

I want to add/link boostrap CDN to my concrete5 (v. 5.6) block. I want it to be specific to this particular block only. I tried to search in the old documentation at

https://legacy-documentation.concrete5.org/developers

but couldn't find anything. I found something in new documentation using assets

https://www.concrete5.org/community/forums/5-7-discussion/how-exactly-do-we-use-asset-registering

but this doesn't seem to work in old version.

Thank You

2

There are 2 best solutions below

0
toesslab On

As said in the legacy-docs (version 5.6.x) under Blocks / Directory Setup / Stylesheets, JavaScript and Other Assets:

The following named items will be automatically added to a page's header, if the block in question has been added to that page:

  • view.css
  • view.js

Additionally, this behavior also applies to any files of any name within the following directories, should they exist:

  • css/
  • js/

So the block's CSS folder (under /application or in a package) is as follows:

blocks/block_handle/css/

0
Ashley Ohlrogge On

You can also use the addHeaderItem call from your view function in the block's controller if you wanted to do something like the CDN, keep in mind that any CSS added will be applied to the whole page unless the classes are specific to the block.