Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jsdf/sprockets-coffee-react
DEPRECATED – Sprockets preprocessor for CJSX (Coffeescript with React JSX markup)
https://github.com/jsdf/sprockets-coffee-react
Last synced: 25 days ago
JSON representation
DEPRECATED – Sprockets preprocessor for CJSX (Coffeescript with React JSX markup)
- Host: GitHub
- URL: https://github.com/jsdf/sprockets-coffee-react
- Owner: jsdf
- License: mit
- Created: 2014-06-04T15:42:32.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-10-03T07:22:26.000Z (about 8 years ago)
- Last Synced: 2024-04-09T22:09:07.741Z (8 months ago)
- Language: Ruby
- Homepage:
- Size: 65.4 KB
- Stars: 85
- Watchers: 3
- Forks: 29
- Open Issues: 6
-
Metadata Files:
- Readme: README.rdoc
- License: LICENSE
Awesome Lists containing this project
- awesome-react-cn - sprockets-coffee-react - Sprockets preprocessor for CJSX (Uncategorized / Uncategorized)
- awesome-react - sprockets-coffee-react - Sprockets preprocessor for CJSX
- awesome-learning-resources - sprockets-coffee-react - Sprockets preprocessor for CJSX (Uncategorized / Uncategorized)
- awesome-react - sprockets-coffee-react - DEPRECATED – Sprockets preprocessor for CJSX (Coffeescript with React JSX markup) (React [🔝](#readme))
README
= sprockets-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}[https://github.com/jsdf/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}[https://github.com/jsdf/coffee-react/issues/32].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:
== Compatibility
sprockets-coffee-react 2.x is compatible with react ^0.12.0sprockets-coffee-react 0.x is compatible with react <=0.11.0
== How to use
Add this to your Gemfile:
gem 'sprockets-coffee-react'
Place a .js.coffee.cjsx or .js.cjsx file, or a .js.coffee
file in your assets directory. When you require it into other JS files the CJSX
markup will be transformed and compiled to Javascript.Eg. if you have a file called my-component.js.coffee which contains
some CJSX code, require it from application.js or somewhere else://= require my-component
== How to use with a Rack application
If you're not using rails, you'll need to register the Sprockets preprocessor manually. Here is an
adapted version of the Rack example provided by Sprockets, which additionally requires and registers
the sprockets-coffee-react engine:require 'sprockets'
require 'sprockets/coffee-react'
map '/assets' do
environment = Sprockets::Environment.new
environment.append_path 'app/assets/javascripts'
environment.append_path 'app/assets/stylesheets'
environment.register_preprocessor 'application/javascript', Sprockets::CoffeeReact
environment.register_engine '.cjsx', Sprockets::CoffeeReactScript
environment.register_engine '.js.cjsx', Sprockets::CoffeeReactScript
run environment
endmap '/' do
run YourRackApp
end== License
Released under the MIT License. See the LICENSE file for further details.
== How to use with Middleman
Add the following to your config.rb file:
require 'sprockets/coffee-react'
::Sprockets.register_preprocessor 'application/javascript', ::Sprockets::CoffeeReact
::Sprockets.register_engine '.cjsx', ::Sprockets::CoffeeReactScript
::Sprockets.register_engine '.js.cjsx', ::Sprockets::CoffeeReactScript