HansSchouten / PHPageBuilder

A drag and drop page builder to manage pages in any PHP project
https://www.phpagebuilder.com
MIT License
739 stars 180 forks source link

CSS inside the block #6

Closed Vanguger closed 4 years ago

Vanguger commented 4 years ago

Hello! Please tell me if it is possible to load a separate css into a block so that it fits in the HEAD?

For example, the file: themes/demo/blocks/intro/view.html

<head>
<link href="[theme-url]/public/party/css/party_intro.css "rel= "stylesheet">
</head>

<div class= "block-intro">...block content...</div>

so that is compiled inside HEAD

HansSchouten commented 4 years ago

Hmm that is a good point, I was already thinking about this in the scenario of adding JavaScripts to a block which need to be collected near the </body> tag (similarly to Laravel's @push('scripts') blade functionality). However, I think for style it would be better to just add all style links directly to the <head> of the view file of your template. For example think about what otherwise happens when you add a particular block twice on the page. Also eventually you probably want to combine all styles with something like https://www.npmjs.com/package/webpack-mix anyway and include only a single .css in your template's head.