Blocks css/js - reduce of HTTP requests

Permalink
I want to create a gallery block with JS libary from a framework.

"THE PROBLEM" - i dont want to add HTTP req for blocks (css and JS). My blocks use the global css of the site (i change the selectors namespaces of view.php to fits this).

In one of the block i download i see this code outline (VIEW.PHP) with inline css & js:
<style>
       my inline css her
</style>
<script>
      my vars
      my (vars) Initialize and the complete script
</script>
<!-- the markup -->
<div>
       <h1>my output markup </h1>
</div>


This is good solution?

I dont understand how c5 handle HTTP requests of block assets and what is the best way to work for good performance/minimize-http-requests.

In other words - If i have in one page - 5 difference blocks - each block with css in the root of the block = I get 5 more HTTP requests ?

siton
 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi siton,

If you need to control CSS and JavaScript based on user input. I believe inline CSS and JavaScript is fine.

For more information on concrete5 asset handling, I recommend reading this section of the documentation:
http://documentation.concrete5.org/developers/assets/overview...

When you use CSS and JavaScript cache registered block assets will be combined. This discussion shows an example of how it works:
http://www.concrete5.org/community/forums/5-7-discussion/asset-cach...
ramonleenders replied on at Permalink Reply
ramonleenders
I wouldn't recommend inline CSS or have an extra .css file. It adds extra requests indeed, and you can easily add this CSS to your theme. Sometimes an Add-On developer may add this though, because he/she can not change your theme. But if you are developing block for your own website, do all CSS in your theme. Keep requests at a minimum, also to keep Google happy! :D