PHPackages                             redcatphp/stylize - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. redcatphp/stylize

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

redcatphp/stylize
=================

Stylize - Css Preprocessor using Scss syntax ( SASS 3.x ) ported to PHP with added supports: php imbrication, php mixin, mixin autoload, extend autoload, font autoload - derived from leafo-scssphp

v2.4.3(9y ago)57721LGPL-3.0+PHPPHP &gt;=5.4.0

Since Aug 20Pushed 9y ago2 watchersCompare

[ Source](https://github.com/redcatphp/stylize)[ Packagist](https://packagist.org/packages/redcatphp/stylize)[ Docs](http://redcatphp.com/stylize-scss)[ RSS](/packages/redcatphp-stylize/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (28)Used By (1)

Stylize
=======

[](#stylize)

Stylize is a CSS Pre-processor using Scss syntax from [SASS](http://sass-lang.com) ( version 3.x ) ported to PHP with additional features.
If you're not familiar with this language, you can consult the basic documentation on [SASS](https://en.wikipedia.org/wiki/Sass_%28stylesheet_language%29). I'll describe here only the PHP API and exclusive features of Stylize. The source code is derived from the excellent [leafo-scssphp](http://leafo.net/scssphp/).

Additional Features to SCSS
---------------------------

[](#additional-features-to-scss)

- [php imbrication](http://redcatphp.com/stylize#php-imbrication)
- [hybride PHP Mixin](http://redcatphp.com/stylize#php-mixin)
- [mixin autoload (include)](http://redcatphp.com/stylize#autoload-mixin)
- [extend autoload](http://redcatphp.com/stylize#autoload-extend)
- [font autoload](http://redcatphp.com/stylize#autoload-font)

Basic Usage
-----------

[](#basic-usage)

### Compiler

[](#compiler)

```
$scss = new \\RedCat\\Stylize\\Compiler();
$scss->setImportPaths(['css']);
$scss->addImportPath('redcat/css');
$scss->compile(file_get_contents('css/style.scss'));
            
```

### Server

[](#server)

The server will handle cache and rebuild it only if the files has changed and also deal in HTTP via Etag and Last-Modified. It also include by default, if they are present, "*\_config.scss*" and "*\_var.scss*". It will use a cache directory by default which is "*.tmp/stylish/*" from current working directory and which need to be writeable (chmod 0777).

```
$server = new \\RedCat\\Stylize\\Server();
$directories = ['css','redcat/css'];
$server->serveFrom('style.scss',$directories);
            
```

PHP Support
-----------

[](#php-support)

The php will be executed before SCSS syntax parser.
By dint of [tokenizer](http://php.net/manual/en/book.tokenizer.php), the php support allow you tu use short php syntax even if *short\_open\_tag* is not enabled in [*php.ini*](http://php.net/manual/en/ini.core.php).

### Imbrication

[](#imbrication)

```
$img-path: '' !default;

    // here is your scss code

    // here is your scss code

            
```

### Hybride PHP Mixin

[](#hybride-php-mixin)

The hybride PHP mixins allow you to get your parameters passed to *include* as php variables in *mixin* declaration and using a different syntax for *include* parameters.
The syntax of hybride php mixins parameters is simple: the separator is the comma "*,*" and no quotes are required, all parameters will be automaticaly typed.
The difference in declaration is that you have to use a "*@?*" instead of "*@*" and same for *include*: "\*@?mixin *" instead of "*@mixin *" and "*@?include *" instead of "*@include \*".
Let's take an example of declaration (the grid from [RedCat's SCSS Toolbox](http://redcatphp.com/css-toolbox)):

```
@import "include/grid.reset-star";
@?mixin grid{
