view plain
view html
<!--
---
**Caution:** The current version is a BETA.
*Stable version checklist:*
- [ x ] ~~*Support all modern Browser and IE 9+*~~
- [ x ] ~~*Support CSS parse on server side*~~
- [ x ] ~~*performance optimization*~~
---
-->
# 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](https://github.com/m13p4/cssc).
* [CSSC source code (~ 47kb)](https://raw.githubusercontent.com/m13p4/cssc/master/cssc-1.0.js)
* [Minified code (~ 13kb)](https://raw.githubusercontent.com/m13p4/cssc/master/cssc-1.0.min.js)
### Browser
```html
<!-- 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)
```javascript
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
```html
<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
```javascript
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](./controller.html).
### Handler
The documentation of the Handler Object can be found on [this page](./handler.html).
---
## License
The project is under the [MIT License](https://raw.githubusercontent.com/m13p4/cssc/master/LICENSE).