Skip to content

Instantly share code, notes, and snippets.

@jcblw
Created December 30, 2015 23:09
Show Gist options
  • Save jcblw/d73743c35271d59b5eb6 to your computer and use it in GitHub Desktop.
Save jcblw/d73743c35271d59b5eb6 to your computer and use it in GitHub Desktop.

rcs

This is to be a quick development/production server that will take react components make pages for them and bundles that with auto reload.

This is to be based of a few directories inside the project.

app
├── components
├── package.json
└── templates

components

Components is where all you components will live this can be top level, or sub components.

Route mapping

  • "/" => "components/index.js"
  • "/foo" => "components/foo.js"

unless another mapping is set in the package.json

templates

Templates is where the the outer templates for the components will live these are exported functions that return a react html document. By default templates/index.js is used.

package.json

The idea behind this is to reduce the amount of configuration to get an isomophic react app up and working, but of course a config is needed. Rather then adding another file to the root of your app you can use the package.json

{
  "rcs": {
    "defaults": {},
    "componentsDir": "components",
    "templatesDir": "templates",
    "routes": {
      "/foo": "bar.js",
      "/bar": {
        "component": "bar.js",
        "template": "_layout.js"
      }
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment