Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1ece366

Browse files
Merge pull request #175 from shakacode/alex/client-babel-6-css-modules-rails-hot
Babel 6 / CSS Modules / Rails hot reloading
2 parents ee769cd + 816f3de commit 1ece366

File tree

97 files changed

+2186
-1201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2186
-1201
lines changed

‎.gitignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ vendor/ruby
2727
.ruby-gemset
2828

2929
# Generated js bundles
30-
/app/assets/javascripts/generated/*
30+
/app/assets/webpack/
3131

3232
# Rubymine/IntelliJ
3333
.idea

‎.scss-lint.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
scss_files:
44
- 'app/assets/stylesheets/**/*.scss'
5-
- 'client/assets/stylesheets/**/*.scss'
5+
- 'client/app/**/*.scss'
6+
7+
exclude: 'client/node_modules/**'
68

79
linters:
810
# BangFormat:
@@ -132,8 +134,8 @@ linters:
132134
# enabled: true
133135
# max_depth: 3
134136
#
135-
# SelectorFormat:
136-
# enabled: true
137+
SelectorFormat:
138+
enabled: false
137139
# convention: hyphenated_lowercase # or 'strict_BEM', or 'hyphenated_BEM', or 'snake_case', or 'camel_case', or a regex pattern
138140
#
139141
# Shorthand:

‎.travis.yml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ install:
1818
- nvm install 5.0
1919
- nvm use 5.0
2020
- npm install
21-
- cd client && npm run build:client
22-
- npm run build:server
2321
before_script:
2422
- export DISPLAY=:99.0
2523
- sh -e /etc/init.d/xvfb start

‎Gemfile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ end
8787
group :test do
8888
gem "coveralls", require: false
8989
gem "rspec-rails"
90+
gem "rspec-retry"
9091
gem "capybara"
9192
gem "capybara-screenshot"
9293
gem "selenium-webdriver"

‎Gemfile.lock‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ GEM
229229
rspec-expectations (~> 3.4.0)
230230
rspec-mocks (~> 3.4.0)
231231
rspec-support (~> 3.4.0)
232+
rspec-retry (0.4.5)
233+
rspec-core
232234
rspec-support (3.4.1)
233235
rubocop (0.35.1)
234236
astrolabe (~> 1.3)
@@ -350,6 +352,7 @@ DEPENDENCIES
350352
rails_12factor
351353
react_on_rails
352354
rspec-rails
355+
rspec-retry
353356
rubocop
354357
ruby-lint
355358
sass-rails

‎Procfile.dev‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
web: rails s
2-
client: sh -c 'rm app/assets/javascripts/generated/* || true && cd client && npm run build:dev:client'
2+
3+
# Run the hot reload server for client development
4+
client: sh -c 'rm app/assets/webpack/* || true && cd client && HOT_RAILS_PORT=3500 npm run build:dev:client'
5+
6+
# Keep the JS fresh for specs
7+
client-spec: sh -c 'cd client && npm run build:test:client'
8+
9+
# Keep the JS fresh for server rendering
310
server: sh -c 'cd client && npm run build:dev:server'
4-
hot: sh -c 'cd client && npm start'
11+
hot: sh -c 'cd client && HOT_PORT=4000 npm start'

‎README.md‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,14 @@ Note that it's important to run the Rails server on a different port than the no
127127

128128
# Webpack configuration
129129
## Config Files
130+
130131
- `webpack.client.base.config.js`: Common configuration file to minimize code duplication for client.rails and client.hot.
131-
- `webpack.client.rails.config.js`: Used to generate the Rails bundles for Rails use.
132-
- `webpack.client.hot.config.js`: Used by server.js to run the Webpack Dev server.
133-
- `webpack.server.rails.config.js`: Common configuration file to minimize code duplication
134-
between the HMR and Rails configurations.
132+
- `webpack.client.rails.build.config.js`: Client side js bundle.
133+
- `webpack.server.rails.build.config.js`: Server side js bundle
134+
135+
These are used for hot reloading (Webpack Dev Server):
136+
- `webpack.client.rails.hot.config.js`: Used to generate the Rails bundles for Rails use so you get hot reloading within your Rails app.
137+
- `webpack.client.hot.config.js`: Used by server.js to run the Webpack Dev server for stubbing the api end points
135138

136139
## Webpack Resources
137140
- Good overview: [Pete Hunt's Webpack Howto](https://github.com/petehunt/webpack-howto)

‎app/assets/javascripts/application.js‎ renamed to ‎app/assets/javascripts/application_dev.js‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
1111
// about supported directives.
1212

13-
// CRITICAL that generated/vendor-bundle must be BEFORE bootstrap-sprockets and turbolinks since it is
14-
// exposing jQuery and jQuery-ujs
15-
//= require generated/vendor-bundle
16-
//= require generated/app-bundle
13+
// All webpack assets in development will be loaded via webpack dev server
14+
// It's important to include them in layout view above this asset
15+
// b/c it exposes jQuery for turbolinks and another non-webpack JS (if any)
1716

18-
// Next two depend on jQuery
17+
// This one depends on jQuery
1918
//= require turbolinks
20-
//= require bootstrap-sprockets
2119

20+
// This will soon be removed as it will be in vendor-bundle with react_on_rails 2.0
2221
//= require react_on_rails
2322

2423
//= require rails_startup
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This file is used in production to server generated JS assets. In development mode, we use the Webpack Dev Server
2+
// to provide assets. This allows for hot reloading of the JS and CSS.
3+
// See app/helpers/application_helper.rb for how the correct assets file is picked based on the Rails environment.
4+
// Those helpers are used here: app/views/layouts/application.html.erb
5+
6+
// These assets are located in app/assets/webpack directory
7+
// CRITICAL that webpack/vendor-bundle must be BEFORE turbolinks
8+
// since it is exposing jQuery and jQuery-ujs
9+
//= require vendor-bundle
10+
//= require app-bundle
11+
12+
// Non-webpack assets incl turbolinks
13+
//= require application_dev

‎app/assets/stylesheets/_bootstrap-custom.scss‎

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /