Adding ability to write require modules that will load CSS content into style nodes

https://github.com/guybedford/require-css/issues/169
Moving writecss common to its own module
Removed extra `}` in the function defition
Adding boolean to keep track of writeCSSDefinition for each layer
A small refactoring for readability when writing cssModules
Fixed issue with writeCss not being returned from the module definition
Merge pull request #170 from MiguelCastillo/master

Writing require modules when running in `r.js`