What I want to do is to turn on PHP5 interpretation for both .css and .js files, while still returning the proper MIME header.
I want to do this so that I can keep the pages I design extremely neat, minimize http requests, and maximize caching.
In other words:
<link rel='stylesheet' href='dynamicsheet.css'>
The requested files would be interpreted as .php allowing them to determine the client platform, browser, and the page requested (as well as anything else you might think of), and intelligently load and concatenate the files, as well as handle load order, dependencies, etc. etc. etc.
Basically, I want to be able to handle these files the same way one handles a make file, or a manifest.
This way, I could tailor the css sheets for the device that was loading the site (for example, tablets would get the tablet .css, etc.) and would cache the sheet needed for that device.
Same with scripts... the scripts loaded by the backend would be dynamically built to match the client device and browser, and would be cached on that machine.
Similarly, it would allow me to break down the .css and .js into more easily manageable files on server side, while the file that the browser actually loaded ('dynamicsheet.css', for example) would then properly manage and compile the required stylesheets and scripts needed for that specific page.
In this way, I could have a single http request load up jQuery, Less, Bootstrap, and both site-wide and page specific scripts...all in a single file, and including proper caching.
Currently, the normal solution to this is requesting and transmitting huge chunks of code that don't even apply to that machine, only to not used it... and doing so through a ton of http requests.
There are so many good reasons for dynamically generating .css and .js that I can't believe it has not been a standard practice for years already.
My problem is that while I can program both client side and web stuff... I have very little knowledge or experience when it comes down to the actual internals of a web server.
Everywhere that I have seen someone ask a question even remotely like this they are told "don't do that", or "just name them all .php". Often the server overhead of interpreting any file other than .php is seen as a "waste of server resources"... but for the resons listed above, I disagree.
Naming all the .css and .js files to .php would leave them with the wrong header information, which would generate ugly errors on the client end.
Does anyone know how to convince the server to do so?
I have heard that I need to modify the httpd.conf, OR the php5.ini, OR etc, etc etc.... yet in each case, no accurate or explicit instructions follow.
Does anyone have a clue how to get this done?
I can't believe it is really THAT hard to do.
Any help would be greatly appreciated, with much kharmic love being fed to Buddha in your name and all.... puppies will smile.