TurbineCSS / Turbine

A collection of PHP-powered tools that are designed to decrease css development time and web developer headache.
http://turbinecss.github.io
GNU Lesser General Public License v3.0
140 stars 19 forks source link

Request: Separated entry script #146

Open MichaelSchmidle opened 13 years ago

MichaelSchmidle commented 13 years ago

Hi Turbine development team,

first of all many thanks for such a great time saver that Turbine is! I only recently started using this great tool but already I cannot imagine going back stupidly writing CSS... =)

However, I have already one "feature" request: Please arrange the files and directories in the Turbine distribution in such a manner that the main code easily can be placed outside the webroot. With the current stable version 1.0.11 this is not possible without hacking lib/base.php.

I imagine the following arrangement of files and folders (only first level shown) in the default distribution:

/
|- Turbine-1.0.11
'- css.php

After unpacking the distribution and placing the Turbine library outside the webroot the directory structure might look as follows:

/
|- libraries
|  |- Turbine-1.0.11
|  |  |- cache
|  |  |- lib
|  |  |- ...
|  |  '- turbine.php
|- ...
'- webroot
   |- css
   |  '- css.php    <= accessible via web; includes '../../libraries/Turbine-1.0.11/turbine.php'
   |- ...
   '- index.html

(Such an entry script of course could hold the configuration array, too—maybe even an array of files to process as alternative to passing a string of semicolon separated file names (css.php?file1.css;file2.cssp)—making it a breeze to use Turbine in different websites with different configurations and upgrading the core software without loosing any dirty hacks in the process.)

In any event you would (only) need to adapt the way the configuration is read in lib/base.php (line 65). Just unzipping the distribution and putting it in its entirety in a web accessible directory of course would sill work.

I hope you like my "feature" request and consider adapting the code.

Thanks for reading, keep up the great work!

Cheers, Mellou

SirPepe commented 13 years ago

That's a good idea and I already hacked something up: https://github.com/SirPepe/Turbine/commit/3bc785d4871163cf6571fae4b06241a6027228ab

Copy css.php and config.php to webroot, set the path to the Turbine installation in the turbine_dir variable in config.php and it mostly works. There is one problem however... Turbines "core" contains some files that must be accessible via web - for instance the HTC files that take care of some bugs in Internet Explorer. I don't really know what to do about these cases at the moment.

MichaelSchmidle commented 13 years ago

Sorry for double posting after accidentally hitting the delete button instead of the edit button (stubby fingers on iPad ;-)) of my previous comment... Here it comes again:

Thanks for your prompt reaction! I'll check it out.

If there are files that need to be accessible via web other than the entry script and there is no way of serving these through the entry script as well (i.e. with the help of get_file_contents() or similar), then separating 'core scripts' and 'web files' would be perfectly fine too of course.

/
|- turbine-core    <= holds the Turbine's main library
'- css    <= holds the files that need to be accessible via web
   |- turbine-web    <= holds the files that cannot be served indirectly through css.php
   '- css.php    <= Turbine's entry script

Anyway, placing as much of Turbine outside the webroot as possible should easily be possible. Thanks for looking into it!

SirPepe commented 13 years ago

We'll figure something out and make this a feature for version 1.2.

MichaelSchmidle commented 13 years ago

Good stuff, thanks.