Yii 1.1: css-vars

Use variables in CSS files.
4 followers

Yii application component for using variables in CSS. Based on: http://net.tutsplus.com/tutorials/html-css-techniques/how-to-add-variables-to-your-css-files/

Documentation

Install:


'preload'=>array(
    'css'
),
'components'=>array(
    'css'=>array(
        'class'=>'application.extensions.CSSVars',
        'privatePath'=>'application.css',
        'publicPath'=>'webroot.css'
    ),
)
Paths:

webroot
    css 
        main.css <-generated CSS written here (public path)
    protected
        css 
            main.css <-create your CSS here (private path)
CSS:

$font: arial, sans-serif;
$main-color: #3D7169; $secondary-color: #000;
h1 {
    font: 200% $font;
    color: $main-color;
}
p {
    background: $secondary-color;
    color: $main-color;
    font-family: $font;
    padding: 10px;
}

Turn off css-vars when your finished:


'preload'=>array(
//  'css'
)

Change Log

March 21, 2010

  • Initial release.

Be the first person to leave a comment

Please to leave your comment.

Create extension