https://github.com/deepredsky/color-app
https://github.com/deepredsky/color-app
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/deepredsky/color-app
- Owner: deepredsky
- Created: 2016-10-11T21:34:17.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-10-11T21:36:49.000Z (over 9 years ago)
- Last Synced: 2025-08-23T09:35:33.211Z (11 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React-Sinatra
An example app using Sinatra and React
### UP & RUNNING
- clone the repo
- `bundle install`
- `npm install`
- `npm run dev`
- open your browser to `localhost:8080`
### WHATS HAPPENING
- when you run `npm run dev`, webpack is transpiling all your JS and CSS into a ghost file (`lib/app/public/app.js`). It then serves up the html file in `lib/app/views/index.html` on a ghost Express server on port 8080.
### BUT WAIT, WE'RE NOT _REALLY_ USING SINATRA?
That's correct. To use the Puma server for Sinatra with the transpiled assets, you'll need to do the following:
- run `npm run build`
- run `ruby lib/app.rb`
This creates a transpiled asset file (`app.js`) of your JS and CSS in the `lib/app/public/` directory. This is great for production, but not so hot for development workflow as you would need to transpile _every time_ you made a change to the JS.
### WHY NOT JUST USE RAILS?
While the React-Rails gem is really great, this is a really simple and lightweight option for using Sinatra and React together without all the weight of Rails.