StyleWright

Created: 2011-07-16 21:55
Updated: 2014-04-16 04:41
php

readme.mkd

#StyleWright StyleWright is a simple PHP library for creating dynamic CSS Files.

##Purpose StyleWright is intended as a simple foundation for anyone with even a basic grasp of PHP and CSS to begin building more dynamic CSS stylesheets. While certainly not as powerful as a system like SASS, it also has a much shallower learning curve.

One could start by simply using StyleWright as simply a stylesheet compiler/minifier/gzipper. Then one might start adding variables in stylesheets. Then one might start writing custom functions or snippets, like a reset for instance. Or not. It can be as simple or complex as you want to make it. StyleWright is just the foundation.

#License Original content copyright (c) 2011 Warren C Miller, http://internetrhetorician.com. Non-original content copyrighted by their creators, and used in accordance with their licensing.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#Documentation ##startFile($save) This starts off a StyleWright file, and should appear as soon as the StyleWright library has been imported. As its job is to set the proper headers for a css page, it must be called before any text is sent to the browser.

###Arguments startFile() takes a single optional boolean argument called $save. If true, $save will cause the browser to open a "Save File" prompt. $save's default value is FALSE.

##endFile($min, $gzip) This will end the CSS File.

###Arguments endFile() takes two optional boolean arguments called $min and $gzip. These, if set to true, will cause the file to be minified – taking out all comments and unnecessary whitespace – and/or gzipped, respectively. These should only be used once the stylesheet goes "live". The default values of $min and $gzip are both FALSE.

##zip() & compress() These two helper functions are used by the endFile() function, and are not intended to be called directly.

##importStyles($name, $directory) This will import the contents of another stylesheet into the main sheet. This allows more modular development, without increasing HTTP requests.

###Arguments importStyles can accept one or two arguments. The first is a string giving the filename of the stylesheet to be imported. The optional second parameter is a string to the path containing the file to be included. By default this is set to "", and leaving it blank will cause StyleWright to assume that the to-be-imported stylesheet is in the same folder the main sheet is in.

#To Do On the core file, there isn't really much I plan on adding, except perhaps a caching mechanism. I do hope to start adding a series of libraries covering different areas, such as a reset, grid system generation, maybe a typographic library. I'll have to see.

That being said, I do hope to develop a more extensive, object-oriented version of StyleWright in the near future, for easier integration with other frameworks.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more