Giter Site home page Giter Site logo

kyleamathews / coffee-react-quickstart Goto Github PK

View Code? Open in Web Editor NEW
254.0 13.0 41.0 1.77 MB

Quickstart for building React single page apps using Coffeescript, Gulp, Webpack, and React-Router

Home Page: http://kyleamathews.github.io/coffee-react-quickstart

License: MIT License

Ruby 4.04% Makefile 0.50% CoffeeScript 40.18% HTML 22.28% JavaScript 5.11% CSS 27.88%

coffee-react-quickstart's Introduction

Coffee React Quickstart

Quickstart for creating React.js web applications.

It has a number of nice goodies baked in including:

  • Live reloading for both CSS and Javascript! This really speeds up development. Live reloading is powered by the Webpack module bundler and react-hot-loader projects.
  • Write your JSX in Coffeescript thanks to coffee-react-transform.
  • Amazing URL-driven-development (UDD) with the react-router project.
  • Uses Gulp for building CSS and Javascript. Run gulp watch for rebuilding css/js on the fly while developing and gulp build to create minified versions for deploying to production.
  • Includes sensible element stylings and several useful Sass plugins:

Install dependencies

Clone this repo and then after entering the new directory run npm install and bundle install. This will install the respective NPM and Ruby Gem dependencies.

You'll also need to have gulp installed globally to run the coffeescript gulpfile: npm install -g gulp

Development

Run in the root of your directory: npm run watch

This will watch the src directories and build on changes and placed the built css and js files in the public directory. It'll serve everything in the /public directory at localhost:8080

Then try editing src/scripts/hello_world.cjsx and see your changes magically show up in your browser with no page reload!

Production build

To build for production, simply run gulp build

Demo

Try out the example app included with this quickstart: http://kyleamathews.github.io/coffee-react-quickstart/

coffee-react-quickstart's People

Contributors

alanhogan avatar gaearon avatar geotre avatar holmesal avatar kyleamathews avatar silasb avatar tryspace avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coffee-react-quickstart's Issues

Trying to adapt gulp & webpack without using coffeescript

I am trying to replace browserify with webpack in order to get react-hot-loader working in my dev setup. Since I am already using gulp and want to stick with it for production build reasons I found this quickstart, since its also using gulp. I tried to adapt it a little bit in order to match my current setup.

2 Main differences, my development source code lives in "src" and my target of building and then serving with the webserver is "build"

I have attached my current gruntfile and webpack.config:
https://gist.github.com/KeKs0r/78ce47ba2e74c4135fc0

One thing which I see is with my gulp server command, only the webdev dev server command is executed, which somehow is not building my main.js. My main javascript file is only build when using "webpack:build-dev", which is then taking 15s.

I thought the watch command alone should spin up a fully working server. Or do I need to manually build everytime beforehand?

Also when I build manually beforehand I end up in errors in webpack with this command:
if ("production" !== process.env.NODE_ENV)
since process.env is undefined.

jsx files and harmony flag

I cannot require .jsx files (from other projects like material-ui). Am I doing something wrong?
Also is there a way to enable ES6 conversion both for .js and .jsx files? (again, I need this because other packages like flux use it).
Thank you for this great project BTW.

Plain coffeescript style?

Should this project also provide examples of how to write without a jsx transform?

e.g.

React = require 'react'
E = React.createElement
N = null
Link = require('react-router').Link
RouteHandler = require('react-router').RouteHandler

# Provides global navigation for app e.g. the "Hello | Styleguide" at the top.
module.exports = React.createClass
  displayName: 'HelloWorld'
  render: ->
    E 'div', N,
      E 'header', N,
         E 'Link', to: "hello", 'Hello'
         '|'
         E 'Link', to: "styleguide", 'Styleguide'
         "| whee" if showWhee
         "#{i} " for i in [1..10]
         E 'RouteHandler'

Webpack's reload is broken.

Just tried installing it locally/fresh and it seems like reloading on changes to .cjsx files is broken. I've had to re-run npm start to see changes.

missing server.coffee

Hi,

I took the server.coffee from your flickr example and it works nicely here, but right now npm start will fail since it's not in this repo. Just a note that you probably want to move it over.

Thanks so much for this code, it let me dive into the deep end of react / coffeescript.

Might I need to add a file loader?

Do images seem to work just fine for you? If so, I’ll do more investigation…

ERROR in ./src/images/sprites@2x/icons-s91a7691adc.png
Module parse failed: /Users/username/Repos/guidebook/gears3fe/src/images/sprites@2x/icons-s91a7691adc.png 
Line 1: Unexpected token ILLEGAL
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
 @ ./~/css-loader!./public/main.css 2:40778-40842 2:41665-41729 2:42557-42621 2:43452-43516

CSS replacement doesn't work

If I run "gulp watch" and then edit any of the SCSS files, the edits do not come through until a cjsx file is edited

Radness.

Just wanted to let you know that after weeks of searching, this is the only boilerplate that actually hotloads react and injects css. Fantastic work, dude.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.