CSSC

CSSC.JS is a JavaScript CSS Controller/Framework for managing Cascading Style Sheets in browser and/or on server.


Installation

To use CSSC you must import the code into your project. You can get the code from GitHub.

Browser

<!-- normal-->
<script type="text/javascript" src="./path/to/csscjs/cssc-1.0.js"></script>

<!-- or minified -->
<script type="text/javascript" src="./path/to/csscjs/cssc-1.0.min.js"></script>

Server (Node.JS)

var CSSC = require('./path/to/csscjs/cssc-1.0.js');

How to use

Browser

The StyleSheets are generated at runtime in the browser and this is immediately available.

Example

<script type="text/javascript" src="./path/to/csscjs/cssc-1.0.min.js"></script>
<script type="text/javascript">
(function(){
    // create an instance outside of the global name space
    var cssc = new CSSC()({
        body: {
            margin: 0,
            h1: {
                'font-size': 20
            }
        }
    });
})();
</script>

Server

On the server side, the StyleSheets have to be parsed. By parsing a CSS string is created.

Example

var CSSC = require('./path/to/csscjs/cssc-1.0.js'), cssString;

CSSC({
    body: {
        margin: 0,
        h1: {
            'font-size': 20
        }
    }
});

cssString = CSSC.parse();

Documentation

Controller (CSSC)

The documentation of the Controller Object can be found on this page.

Handler

The documentation of the Handler Object can be found on this page.


License

The project is under the MIT License.