UNPKG

1.19 kBMarkdownView Raw
1# gatsby-plugin-coffeescript
2
3Provides drop-in support for CoffeeScript and CJSX.
4
5## Install
6
7`npm install gatsby-plugin-coffeescript`
8
9## How to use
10
111. Include the plugin in your `gatsby-config.js` file.
122. Write your components in CJSX or CoffeeScript.
13
14```javascript
15// in gatsby-config.js
16plugins: [
17 // no configuration
18 `gatsby-plugin-coffeescript`,
19 // custom configuration
20 {
21 resolve: `gatsby-plugin-coffeescript`,
22 // options are passed directly to the compiler
23 options: {},
24 },
25]
26```
27
28## Notes
29
30First, note that CoffeeScript + React is a troubled combination. This plugin
31relies upon deprecated modules that may someday prove to be dysfunctional or
32otherwise deficient.
33
34Furthermore, note that the installed version of CoffeeScript is @next. This is
35not optional - _named exports are required for page queries to work properly._
36
37You will need to manually edit your `coffee-loader` installation and install
38`coffeescript` separately in your project directory to ensure that
39CoffeeScript@next is being loaded. The very first line of source in the former's
40`index.js` should be the following: note the lack of dash.
41
42```js
43var coffee = require("coffeescript")
44```