Skip to content

Use Regions to deliver CSS, JavaScript etc

russellfeeed edited this page May 15, 2017 · 1 revision

I was trying to figure out how to use Cockpit as a repository for serving CSS and JS files.

MediaManager is fine, but I wanted to have some sort of version control. Regions gave me version control, but that only served HTML (Reponse has a "Content-Type: text/html" Header).

The solution is to do this in your Region Template:

<?php 
//header("Content-type: text/css"); 
cockpit()->response->mime = 'css';
?>
body { color:red !important;}