Meet npm Pro: unlimited public & private packages + package-based permissions.Learn more »

grunt-coffee-react

5.0.2 • Public • Published

grunt-coffee-react

STATUS: DEPRECATED

This tool is no longer maintained. If you need to transition your codebase from it, a codemod is available to do so: cjsx-codemod

This project started as a way for me to explore how JSX could fit into Coffeescript syntax, as a quickly hacked together prototype. While I never really promoted it, it quickly took on a life of its own, and before long people were asking for it to support all kinds of different use cases. On top of that I had no experience writing parsers, so the result is something with insurmountable limitations.

As I eventually stopped using Coffeescript I ended up neglecting this project, but as people were using it I didn't want to kill it. I really should have, however, because it meant that people were using a crappy, ill-conceived, unmaintained tool. Now, long overdue, I'm putting it out to pasture.

Original readme follows:

Compile coffee-react-transform CJSX files to JavaScript.

Getting Started

This plugin requires Grunt ~0.4.0

Version 1.0 and higher of this plugin are only compatible with React 0.11.2 and higher

note

npm install grunt-coffee-react --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-coffee-react');

'cjsx' task

Run this task with the grunt cjsx command.

Task targets, files and options may be specified according to the grunt Configuring tasks guide.

Options

separator

Type: String Default: linefeed

Concatenated files will be joined on this string.

bare

Type: boolean

Compile the JavaScript without the top-level function safety wrapper.

join

Type: boolean Default: false

When compiling multiple CJSX files into a single .js file, concatenate first.

sourceMap

Type: boolean Default: false

Compile JavaScript and create a .map file linking it to the CJSX source. When compiling multiple .coffee files to a single .js file, concatenation occurs as though the 'join' option is enabled

sourceMapDir

Type: String Default: (same path as your compiled js files)

Generated source map files will be created here.

joinExt

Type: String Default: '.src.coffee'

Resulting extension when joining multiple CJSX files.

Usage Examples

cjsx: {
  compile: {
    files: {
      'path/to/result.js': 'path/to/source.coffee', // 1:1 compile
      'path/to/another.js': ['path/to/sources/*.cjsx', 'path/to/more/*.coffee'] // compile and concat into single file
    }
  },
 
  compileBare: {
    options: {
      bare: true
    },
    files: {
      'path/to/result.js': 'path/to/source.coffee', // 1:1 compile
      'path/to/another.js': ['path/to/sources/*.cjsx', 'path/to/more/*.coffee'] // compile and concat into single file
    }
  },
 
  compileJoined: {
    options: {
      join: true
    },
    files: {
      'path/to/result.js': 'path/to/source.coffee', // 1:1 compile, identical output to join = false
      'path/to/another.js': ['path/to/sources/*.cjsx', 'path/to/more/*.coffee'] // concat then compile into single file
    }
  },
 
  compileWithMaps: {
    options: {
      sourceMap: true
    },
    files: {
      'path/to/result.js': 'path/to/source.coffee', // 1:1 compile
      'path/to/another.js': ['path/to/sources/*.cjsx', 'path/to/more/*.coffee'] // concat then compile into single file
    }
  },
 
  compileWithMapsDir: {
    options: {
      sourceMap: true,
      sourceMapDir: 'path/to/maps/' // source map files will be created here
    },
    files: {
      'path/to/result.js': 'path/to/source.coffee'
    }
  },
 
  glob_to_multiple: {
    expand: true,
    flatten: true,
    cwd: 'path/to',
    src: ['*.coffee'],
    dest: 'path/to/dest/',
    ext: '.js'
  }
 
}

For more examples on how to use the expand API to manipulate the default dynamic path construction in the glob_to_multiple examples, see "Building the files object dynamically" in the grunt wiki entry Configuring Tasks.

Keywords

Install

npm i grunt-coffee-react

DownloadsWeekly Downloads

429

Version

5.0.2

License

none

Last publish

Collaborators

  • avatar