gatsbyjs / gatsby-starter-documentation

This starter is for Gatsby v0 and is not maintained
67 stars 45 forks source link

Converted CoffeeScript and CJSX to ES6 and JSX #1

Closed gesposito closed 9 years ago

gesposito commented 9 years ago

Notes about conversion

Automation

I used https://github.com/js2coffee/js2coffee for CoffeeScript files and

https://github.com/jsdf/coffee-react for CJSX ones.

Conversion

require are translated to imports, with optional destructuring assignment: import { prune, include as includes } from 'underscore.string';

CSS are imported thanks to webpack: import '../css/styles.css';

@props are converted to this.props thanks to React.autoBind.

JSX tags stay the same, style properties need commas.

Spread ... operators stay the same.

Multiline strings and template strings need backticks `` instead of single/double quotes. String substitution in template strings need the${var}syntax instead of#{var}`.

var should probably be replaced by either let or const.

ES6 Classes

I personally prefer ES6 Classes over React.createClasses but that would require some more changes in the gatsby codebase and they would be a bit opinionated right now.

KyleAMathews commented 9 years ago

Thanks!