Adding styles from a css files to the react component. Using templates where you set list of selectors and css files separated by comma.
Css files parsed by css
$ npm install gulp-reacss --save-dev
// component.js
var styles = @('.some',
'.some .one'
=>
'css/comp.css',
'css/all.css')
var Component = React.createClass({
render: function(){
return (
<div className="one" style={styles}></div>
);
}
});
// gulpfile.js
var gulp = require('gulp');
var reacss = require('gulp-reacss');
gulp.task('reacss', function () {
return gulp.src('component.js')
.pipe(reacss())
.pipe(gulp.dest('dist'));
});
MIT © Yodairish 2014