1 | # gatsby-plugin-coffeescript
|
2 |
|
3 | Provides drop-in support for CoffeeScript and CJSX.
|
4 |
|
5 | ## Install
|
6 |
|
7 | `npm install gatsby-plugin-coffeescript`
|
8 |
|
9 | ## How to use
|
10 |
|
11 | 1. Include the plugin in your `gatsby-config.js` file.
|
12 | 2. Write your components in CJSX or CoffeeScript.
|
13 |
|
14 | ```javascript
|
15 | // in gatsby-config.js
|
16 | plugins: [
|
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 |
|
30 | First, note that CoffeeScript + React is a troubled combination. This plugin
|
31 | relies upon deprecated modules that may someday prove to be dysfunctional or
|
32 | otherwise deficient.
|
33 |
|
34 | Furthermore, note that the installed version of CoffeeScript is @next. This is
|
35 | not optional - _named exports are required for page queries to work properly._
|
36 |
|
37 | You will need to manually edit your `coffee-loader` installation and install
|
38 | `coffeescript` separately in your project directory to ensure that
|
39 | CoffeeScript@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
|
43 | var coffee = require("coffeescript")
|
44 | ```
|