Trying to get Quick Started, feel a little lost... (needs my cjsx, react, stylus require etc)


#1

Hi, I am migrating from Express/Node Brunch React Setup. I got interested in Meteor because of it’s support for ReactMeteor.

I am trying to get going with CoffeeScript, and I want CJSX support (please):

perhaps: https://www.npmjs.com/package/node-cjsx

I’m trying to get this all rolling, but I’m trying to create a plugin, the documentation is a little terse - and a little too white paper like regarding: https://github.com/meteor/meteor/wiki/CompileStep-API-for-Build-Plugin-Source-Handlers

I guess I am still looking for some more examples that also show file trees and step by step to create this type of plugin. I’m scratching my head, because I want to know:

  1. How do I add this plugin

  2. Do I have to add this to a config?

  3. How do I debug and console output when these plugins run??

    function handler(compileStep) {
    var source = compileStep.read().toString(‘utf8’);
    var outputFile = compileStep.inputPath + “.js”;

    compileStep.addJavaScript({
    path: outputFile,
    sourcePath: compileStep.inputPath,
    data: reactTools.transform(source, {
    harmony: true
    })
    });
    }

Plugin.registerSourceHandler(“jsx”, handler);

Also, I am used to using require in code for coffeescript modules, I like to separate my components (I don’t like messy globals everywhere btw) best way to take this practice I am use to and migrate my thinking or bending react into being my b*tch, I am looking for those suggestions too.

I like the meteor add command, but the support is a little too limited and it does a little voodoo I am not use to when working with npm.

Thanks for your answers
Looking forward to coding on my app and giving it a shot.


#2

bending react into being my b*tch

Please don’t use language like this on the forums.

Having said that, you’re trying to enter Meteor development at level 8. I recommend building a basic app first and learning about the environment, conventions, and assumptions of Meteor app development before trying to do something relatively advanced like immediately combining Coffeescript JSX, plugin development, build handlers, npm, require, etc.


#3

Good Idea, I found this, I think I’ll just try to dive right in and try to write a plugin. I have been writing CoffeeScript for 3 years now, and it’s my favorite, that and Stylus are more necessities rather than “Nice to Haves”

https://atmospherejs.com/i/publishing

Thanks


#4

Right now using CJSX isn’t going to be turn key. Meteor released a preview of their React package which can be used by adding the react package.

However if you want to use CJSX you’ll have to manually add all of the packages needed minus JSX (react-runtime, and react-data)

You’ll need to then create your own package similar to their JSX package, except with CoffeeScript of course. They’re using Babel to compile, not sure what you need for CJSX but it would need to ultimately hook into the build step like they do with Babel.

Good luck!


#5

Hey thanks for the feedback, I got a package built that does what I want:

https://atmospherejs.com/reduxfj/react-meteor-cjsx

Based on the ReactMeteor (replaces that) and adds .cjsx support.