I would like to see an action hook added so that we can enqueue scripts/stylesheets for specific elements. This would allow us to enqueue these files if and only if the element is being used. For example, I like to add a custom javascript file that enhances the functionality of the checkbox filters. Right now, I have to add a conditional to target the specific page(s) or else it gets added across the entire site.
It looks like this would be a very easy thing to do. Something like this…
Not every element has a script or stylesheet I could use that for. The filters do, but other elements don’t enqueue anything. I used filters as an example.
Also, it’s not just scripts I want to enqueue. Using the method you mentioned for stylesheets will cause a FOUC.
Maybe introduce a new action like do_action( 'bricks/assets/on_demand_enqueue_asset, $bricks_settings_string ); in assets.php, placed before Font Awesome is enqueued. This would run early enough for developers to access $bricks_settings_string and conditionally enqueue their own assets in the <head> or footer.
The Element API’s enqueue_scripts() method currently only loads assets in the footer.