Block Templates Resources
Permalink
Hi,
with 5.7 when I make a template for a block, I need to duplicate it's resources (css, js, whatever) because otherwise it throws 404 errors in the console. I tried adding the requireAssets in page_theme but it did nothing. is there some simple stuff I'm missing or do I really need to copy those files to Application/Blocks/My_Block_Override/
Thanks
with 5.7 when I make a template for a block, I need to duplicate it's resources (css, js, whatever) because otherwise it throws 404 errors in the console. I tried adding the requireAssets in page_theme but it did nothing. is there some simple stuff I'm missing or do I really need to copy those files to Application/Blocks/My_Block_Override/
Thanks
Hi MrKDilkington,
I'm just overriding a core block, i.e. the Page List.
I need to copy the view.css into application/blocks/page_list otherwise it's a missing resource in the browser console.
Like this:
application /
— blocks /
— — page_list /
— — — templates /
— — — — mytemplate.php
— — — view.css <---- This has to be here, otherwise it's flagged as missing...
I'm just overriding a core block, i.e. the Page List.
I need to copy the view.css into application/blocks/page_list otherwise it's a missing resource in the browser console.
Like this:
application /
— blocks /
— — page_list /
— — — templates /
— — — — mytemplate.php
— — — view.css <---- This has to be here, otherwise it's flagged as missing...
@GBNT
Yes, I believe that templates use their own view assets.
To include template specific assets, you put them in a folder. The folder name will be the template name.
application\blocks\page_list\templates\mytemplate\view.php
application\blocks\page_list\templates\mytemplate\view.css
Yes, I believe that templates use their own view assets.
To include template specific assets, you put them in a folder. The folder name will be the template name.
application\blocks\page_list\templates\mytemplate\view.php
application\blocks\page_list\templates\mytemplate\view.css
Yes, I know that, but that file is not in a template folder, it's in the root folder of the block, needed for every template.
Are you creating custom block templates or overriding a block?
Which block are you working with?