This is a temporary solution. Might change in the near future, this depends on how create-react-app will implement testing.
create-react-app quick-test-example
cd quick-test-example
npm run eject| # | |
| # CORS header support | |
| # | |
| # One way to use this is by placing it into a file called "cors_support" | |
| # under your Nginx configuration directory and placing the following | |
| # statement inside your **location** block(s): | |
| # | |
| # include cors_support; | |
| # | |
| # As of Nginx 1.7.5, add_header supports an "always" parameter which |
| 'use strict'; | |
| const path = require('path'); | |
| const webpack = require('webpack'); | |
| const production = process.env.NODE_ENV === 'production'; | |
| const babelPlugins = ['jsx-tagclass']; | |
| const babelProdPlugins = babelPlugins.concat( | |
| ['transform-react-constant-elements', 'transform-react-inline-elements'] |
When using react-rails for an internationalized app it makes a lot of sense to use i18n-js for translations, so that you can reuse the the strings from your rails app's .yml files (and all the tooling & services that exist around that).
When you use the prerender feature of react-rails you face 2 problems:
translation.js & i18n.js from i18n-js need to be loaded inside the server-side JS prerendering processes, which is achieved by loading them inside the components.js.locale of each HTTP request. This is done by adding a custom renderer and using the before_render hook to configure i18n-js accordingly for each render call.| # define a method to run rake tasks | |
| def run_rake(task, options={}, &block) | |
| rake = fetch(:rake, 'rake') | |
| rails_env = fetch(:rails_env, 'production') | |
| command = "cd #{current_path} && #{rake} #{task} RAILS_ENV=#{rails_env}" | |
| run(command, options, &block) | |
| end |
| # Ignore static version of the site (used to upload error pages to S3 for Heroku errors) | |
| /out |
| $ brew install openssl readline | |
| $ CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl` --with-readline-dir=`brew --prefix readline`" rbenv install 2.0.0-p353 |
| π | π | π | π |
π© | π | π | π | π¨ | π° | π£ | π’ | π | π | π² | π± |
| π« | π | π‘ | π€ | πͺ | π | π·
π | π΅ | πΏ | π | π | πΆ | π | π½ | π | π | π | β€οΈ | π | π | π | π | π | π | π | β¨
| #Save this file as hax_background_jobs_in_unicorn.ru | |
| #In one terminal run: unicorn hax_background_jobs_in_unicorn.ru | |
| #In another run: curl -v localhost:8080 | |
| class CleverMailSender | |
| class << self; attr_accessor :emails_to_send; end | |
| self.emails_to_send = [] | |
| class BodyProxy | |
| def initialize(body) | |
| @body = body |