Sails.js with React.js, how to do it correctly?
I found the right solution.
UPD: Now, we can use https://github.com/erikschlegel/sails-generate-reactjs
I have created grunt-reactify to allow you to have a bundle file for a JSX file, in order to make it easier to work with modular React components. All what you have to do is to specify a parent destination folder and the source files:
grunt.initConfig({
reactify: {
'tmp': 'test/**/*.jsx'
},
})
In Sails, Go to the tasks/config folder and create a new file "reactify.js" and Insert the following code:
module.exports = function (grunt) {
grunt.config.set('reactify', {
'[Destination folder]': '[folder containing React Components]/**/*.jsx'
});
grunt.loadNpmTasks('grunt-reactify');
};
Then go to the file tasks/register/compileAssets.js and add reactify:
module.exports = function (grunt) {
grunt.registerTask('compileAssets', [
'clean:dev',
'jst:dev',
'less:dev',
'copy:dev',
'coffee:dev',
'reactify'
]);
};
and that's it !