react_on_rails 1.0.0.pre → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dockerignore +2 -0
- data/.eslintignore +2 -0
- data/.eslintrc +1 -0
- data/.gitignore +4 -0
- data/.jscsrc +2 -2
- data/.rubocop.yml +2 -0
- data/.scss-lint.yml +3 -3
- data/.travis.yml +31 -18
- data/Dockerfile_ci +12 -0
- data/Dockerfile_tests +12 -0
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.md +170 -290
- data/Rakefile +20 -7
- data/app/helpers/react_on_rails_helper.rb +5 -5
- data/docker-compose.yml +12 -0
- data/docs/Contributing.md +26 -2
- data/docs/gen-notes/react_syntax.md +3 -0
- data/docs/gen-notes/reducers.md +31 -0
- data/docs/generator_testing_script.md +50 -0
- data/docs/linters.md +8 -0
- data/docs/manual_configuration.md +202 -0
- data/docs/node_dependencies_and_npm.md +29 -0
- data/lib/generators/react_on_rails/base_generator.rb +116 -0
- data/lib/generators/react_on_rails/bootstrap_generator.rb +84 -0
- data/lib/generators/react_on_rails/generator_helper.rb +48 -0
- data/lib/generators/react_on_rails/heroku_deployment_generator.rb +22 -0
- data/lib/generators/react_on_rails/install_generator.rb +86 -0
- data/lib/generators/react_on_rails/linters_generator.rb +38 -0
- data/lib/generators/react_on_rails/react_no_redux_generator.rb +37 -0
- data/lib/generators/react_on_rails/react_with_redux_generator.rb +61 -0
- data/lib/generators/react_on_rails/templates/base/base/Procfile.dev.tt +4 -0
- data/lib/generators/react_on_rails/templates/base/base/REACT_ON_RAILS.md +16 -0
- data/lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rb +5 -0
- data/lib/generators/react_on_rails/templates/base/base/app/views/hello_world/index.html.erb.tt +6 -0
- data/lib/generators/react_on_rails/templates/base/base/client/.babelrc +3 -0
- data/lib/generators/react_on_rails/templates/base/base/client/REACT_ON_RAILS_CLIENT_README.md +3 -0
- data/lib/generators/react_on_rails/templates/base/base/client/app/bundles/HelloWorld/startup/clientGlobals.jsx +4 -0
- data/lib/generators/react_on_rails/templates/base/base/client/index.jade +15 -0
- data/lib/generators/react_on_rails/templates/base/base/client/npm-shrinkwrap.json +2907 -0
- data/lib/generators/react_on_rails/templates/base/base/client/server.js +58 -0
- data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.base.config.js +58 -0
- data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.hot.config.js +65 -0
- data/lib/generators/react_on_rails/templates/base/base/client/webpack.client.rails.config.js +45 -0
- data/lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb +30 -0
- data/lib/generators/react_on_rails/templates/base/base/lib/tasks/assets.rake +26 -0
- data/lib/generators/react_on_rails/templates/base/base/package.json +31 -0
- data/lib/generators/react_on_rails/templates/base/server_rendering/client/app/bundles/HelloWorld/startup/serverGlobals.jsx +3 -0
- data/lib/generators/react_on_rails/templates/base/server_rendering/client/webpack.server.rails.config.js +37 -0
- data/lib/generators/react_on_rails/templates/bootstrap/app/assets/stylesheets/_bootstrap-custom.scss +63 -0
- data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_post-bootstrap.scss +10 -0
- data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_pre-bootstrap.scss +8 -0
- data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_react-on-rails-sass-helper.scss +19 -0
- data/lib/generators/react_on_rails/templates/bootstrap/client/bootstrap-sass.config.js +89 -0
- data/lib/generators/react_on_rails/templates/client/README.md +97 -0
- data/lib/generators/react_on_rails/templates/heroku_deployment/.buildpacks +2 -0
- data/lib/generators/react_on_rails/templates/heroku_deployment/Procfile +1 -0
- data/lib/generators/react_on_rails/templates/linters/client/.eslintignore +1 -0
- data/lib/generators/react_on_rails/templates/linters/client/.eslintrc +17 -0
- data/lib/generators/react_on_rails/templates/linters/client/.jscsrc +7 -0
- data/lib/generators/react_on_rails/templates/linters/lib/tasks/brakeman.rake +17 -0
- data/lib/generators/react_on_rails/templates/linters/lib/tasks/ci.rake +33 -0
- data/lib/generators/react_on_rails/templates/linters/lib/tasks/linters.rake +81 -0
- data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx +39 -0
- data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/containers/HelloWorld.jsx +33 -0
- data/lib/generators/react_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx +11 -0
- data/lib/generators/react_on_rails/templates/no_redux/base/client/package.json.tt +75 -0
- data/lib/generators/react_on_rails/templates/no_redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx +11 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/actions/helloWorldActionCreators.jsx +8 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/components/HelloWorldWidget.jsx +48 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/constants/helloWorldConstants.jsx +8 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/containers/HelloWorld.jsx +43 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/reducers/helloWorldReducer.jsx +21 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/reducers/index.jsx +14 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/startup/HelloWorldAppClient.jsx +20 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/bundles/HelloWorld/store/helloWorldStore.jsx +35 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/app/lib/middlewares/loggerMiddleware.js +25 -0
- data/lib/generators/react_on_rails/templates/redux/base/client/package.json.tt +82 -0
- data/lib/generators/react_on_rails/templates/redux/server_rendering/client/app/bundles/HelloWorld/startup/HelloWorldAppServer.jsx +21 -0
- data/lib/react_on_rails.rb +1 -7
- data/lib/react_on_rails/configuration.rb +14 -5
- data/lib/react_on_rails/engine.rb +7 -0
- data/lib/react_on_rails/server_rendering_pool.rb +14 -1
- data/lib/react_on_rails/version.rb +1 -1
- data/react_on_rails.gemspec +2 -2
- data/ruby-lint.yml +1 -0
- metadata +75 -11
- data/Dockerfile +0 -14
- data/docs/README.md +0 -1
@@ -0,0 +1,58 @@
|
|
1
|
+
// This file is used by the webpack HMR dev server to load your component without using Rails
|
2
|
+
// It should simply match routes to basic HTML or jade files that render your component
|
3
|
+
/* eslint-disable no-console, func-names, no-var */
|
4
|
+
var bodyParser = require('body-parser');
|
5
|
+
var webpack = require('webpack');
|
6
|
+
var WebpackDevServer = require('webpack-dev-server');
|
7
|
+
var jade = require('jade');
|
8
|
+
var sleep = require('sleep');
|
9
|
+
var config = require('./webpack.client.hot.config');
|
10
|
+
|
11
|
+
var server = new WebpackDevServer(webpack(config), {
|
12
|
+
publicPath: config.output.publicPath,
|
13
|
+
hot: true,
|
14
|
+
historyApiFallback: true,
|
15
|
+
stats: {
|
16
|
+
colors: true,
|
17
|
+
hash: false,
|
18
|
+
version: false,
|
19
|
+
chunks: false,
|
20
|
+
children: false,
|
21
|
+
},
|
22
|
+
});
|
23
|
+
|
24
|
+
// See tutorial for example of using AJAX:
|
25
|
+
// https://github.com/shakacode/react-webpack-rails-tutorial
|
26
|
+
|
27
|
+
// server.app.use(bodyParser.json(null));
|
28
|
+
// server.app.use(bodyParser.urlencoded({extended: true}));
|
29
|
+
// server.app.get('/hello_world.json', function(req, res) {
|
30
|
+
// res.setHeader('Content-Type', 'application/json');
|
31
|
+
// res.send(JSON.stringify(name));
|
32
|
+
// });
|
33
|
+
|
34
|
+
// server.app.post('/hello_world.json', function(req, res) {
|
35
|
+
// console.log('Processing name: %j', req.body.name);
|
36
|
+
// console.log('(shhhh...napping 1 seconds)');
|
37
|
+
// sleep.sleep(1);
|
38
|
+
// console.log('Just got done with nap!');
|
39
|
+
// name = req.body.name;
|
40
|
+
// res.setHeader('Content-Type', 'application/json');
|
41
|
+
// res.send(JSON.stringify(req.body.name));
|
42
|
+
// });
|
43
|
+
|
44
|
+
var initialName = 'Stranger';
|
45
|
+
|
46
|
+
server.app.use('/', function(req, res) {
|
47
|
+
var locals = {
|
48
|
+
props: JSON.stringify(initialName),
|
49
|
+
};
|
50
|
+
var layout = process.cwd() + '/index.jade';
|
51
|
+
var html = jade.compileFile(layout, { pretty: true })(locals);
|
52
|
+
res.send(html);
|
53
|
+
});
|
54
|
+
|
55
|
+
server.listen(4000, 'localhost', function(err) {
|
56
|
+
if (err) console.log(err);
|
57
|
+
console.log('Listening at localhost:4000...');
|
58
|
+
});
|
@@ -0,0 +1,58 @@
|
|
1
|
+
// Common client-side webpack configuration used by webpack.hot.config and webpack.rails.config.
|
2
|
+
|
3
|
+
const webpack = require('webpack');
|
4
|
+
const path = require('path');
|
5
|
+
|
6
|
+
module.exports = {
|
7
|
+
|
8
|
+
// the project dir
|
9
|
+
context: __dirname,
|
10
|
+
entry: {
|
11
|
+
|
12
|
+
// See use of 'vendor' in the CommonsChunkPlugin inclusion below.
|
13
|
+
vendor: [
|
14
|
+
'babel-core/polyfill',
|
15
|
+
'jquery',
|
16
|
+
'jquery-ujs',
|
17
|
+
'react',
|
18
|
+
'react-dom',
|
19
|
+
],
|
20
|
+
|
21
|
+
// This will contain the app entry points defined by webpack.hot.config and webpack.rails.config
|
22
|
+
app: [
|
23
|
+
'./app/bundles/HelloWorld/startup/clientGlobals',
|
24
|
+
],
|
25
|
+
},
|
26
|
+
resolve: {
|
27
|
+
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx', '.scss', '.css', 'config.js'],
|
28
|
+
alias: {
|
29
|
+
lib: path.join(process.cwd(), 'app', 'lib'),
|
30
|
+
},
|
31
|
+
},
|
32
|
+
plugins: [
|
33
|
+
|
34
|
+
// https://webpack.github.io/docs/list-of-plugins.html#2-explicit-vendor-chunk
|
35
|
+
new webpack.optimize.CommonsChunkPlugin({
|
36
|
+
|
37
|
+
// This name 'vendor' ties into the entry definition
|
38
|
+
name: 'vendor',
|
39
|
+
|
40
|
+
// We don't want the default vendor.js name
|
41
|
+
filename: 'vendor-bundle.js',
|
42
|
+
|
43
|
+
// Passing Infinity just creates the commons chunk, but moves no modules into it.
|
44
|
+
// In other words, we only put what's in the vendor entry definition in vendor-bundle.js
|
45
|
+
minChunks: Infinity,
|
46
|
+
}),
|
47
|
+
],
|
48
|
+
module: {
|
49
|
+
loaders: [
|
50
|
+
|
51
|
+
// React is necessary for the client rendering:
|
52
|
+
{test: require.resolve('react'), loader: 'expose?React'},
|
53
|
+
{test: require.resolve('react-dom'), loader: 'expose?ReactDOM'},
|
54
|
+
{test: require.resolve('jquery'), loader: 'expose?jQuery'},
|
55
|
+
{test: require.resolve('jquery'), loader: 'expose?$'},
|
56
|
+
],
|
57
|
+
},
|
58
|
+
};
|
@@ -0,0 +1,65 @@
|
|
1
|
+
// This config file setups up the Webpack Dev Server: https://webpack.github.io/docs/webpack-dev-server.html
|
2
|
+
// Run like this:
|
3
|
+
// cd client && node server.js
|
4
|
+
|
5
|
+
const webpack = require('webpack');
|
6
|
+
const path = require('path');
|
7
|
+
const config = require('./webpack.client.base.config');
|
8
|
+
|
9
|
+
config.entry.app.push(
|
10
|
+
|
11
|
+
// Webpack dev server
|
12
|
+
'webpack-dev-server/client?http://localhost:4000',
|
13
|
+
'webpack/hot/dev-server',
|
14
|
+
|
15
|
+
// See: https://github.com/shakacode/bootstrap-sass-loader
|
16
|
+
// We're using the bootstrap-sass loader.
|
17
|
+
'bootstrap-sass!./bootstrap-sass.config.js'
|
18
|
+
);
|
19
|
+
|
20
|
+
config.output = {
|
21
|
+
|
22
|
+
// this file is served directly by webpack
|
23
|
+
filename: '[name]-bundle.js',
|
24
|
+
path: __dirname,
|
25
|
+
};
|
26
|
+
config.plugins.unshift(new webpack.HotModuleReplacementPlugin());
|
27
|
+
config.devtool = 'eval-source-map';
|
28
|
+
|
29
|
+
// All the styling loaders only apply to hot-reload, not rails
|
30
|
+
config.module.loaders.push(
|
31
|
+
{
|
32
|
+
test: /\.jsx?$/,
|
33
|
+
loader: 'babel',
|
34
|
+
exclude: /node_modules/,
|
35
|
+
query: {
|
36
|
+
plugins: ['react-transform'],
|
37
|
+
extra: {
|
38
|
+
'react-transform': {
|
39
|
+
transforms: [
|
40
|
+
{
|
41
|
+
transform: 'react-transform-hmr',
|
42
|
+
imports: ['react'],
|
43
|
+
locals: ['module'],
|
44
|
+
},
|
45
|
+
],
|
46
|
+
},
|
47
|
+
},
|
48
|
+
},
|
49
|
+
},
|
50
|
+
{test: /\.css$/, loader: 'style-loader!css-loader'},
|
51
|
+
{
|
52
|
+
test: /\.scss$/,
|
53
|
+
loader: 'style!css!sass?outputStyle=expanded&imagePath=/assets/images&includePaths[]=' +
|
54
|
+
path.resolve(__dirname, './assets/stylesheets'),
|
55
|
+
},
|
56
|
+
|
57
|
+
// The url-loader uses DataUrls. The file-loader emits files.
|
58
|
+
{test: /\.woff$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'},
|
59
|
+
{test: /\.woff2$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'},
|
60
|
+
{test: /\.ttf$/, loader: 'file-loader'},
|
61
|
+
{test: /\.eot$/, loader: 'file-loader'},
|
62
|
+
{test: /\.svg$/, loader: 'file-loader'}
|
63
|
+
);
|
64
|
+
|
65
|
+
module.exports = config;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
// Run like this:
|
2
|
+
// cd client && npm run build:dev
|
3
|
+
// Note that Foreman (Procfile.dev) has also been configured to take care of this.
|
4
|
+
|
5
|
+
// NOTE: All style sheets handled by the asset pipeline in rails
|
6
|
+
|
7
|
+
const webpack = require('webpack');
|
8
|
+
const config = require('./webpack.client.base.config');
|
9
|
+
|
10
|
+
const devBuild = process.env.NODE_ENV !== 'production';
|
11
|
+
|
12
|
+
config.output = {
|
13
|
+
filename: '[name]-bundle.js',
|
14
|
+
path: '../app/assets/javascripts/generated',
|
15
|
+
};
|
16
|
+
|
17
|
+
// You can add entry points specific to rails here
|
18
|
+
config.entry.vendor.unshift(
|
19
|
+
'es5-shim/es5-shim',
|
20
|
+
'es5-shim/es5-sham'
|
21
|
+
);
|
22
|
+
|
23
|
+
// See webpack.common.config for adding modules common to both the webpack dev server and rails
|
24
|
+
|
25
|
+
config.module.loaders.push(
|
26
|
+
{test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/},
|
27
|
+
{test: require.resolve('react'), loader: 'imports?shim=es5-shim/es5-shim&sham=es5-shim/es5-sham'}
|
28
|
+
);
|
29
|
+
|
30
|
+
module.exports = config;
|
31
|
+
|
32
|
+
if (devBuild) {
|
33
|
+
console.log('Webpack dev build for Rails'); // eslint-disable-line no-console
|
34
|
+
module.exports.devtool = 'eval-source-map';
|
35
|
+
} else {
|
36
|
+
config.plugins.push(
|
37
|
+
new webpack.DefinePlugin({
|
38
|
+
'process.env': {
|
39
|
+
NODE_ENV: JSON.stringify('production'),
|
40
|
+
},
|
41
|
+
}),
|
42
|
+
new webpack.optimize.DedupePlugin()
|
43
|
+
);
|
44
|
+
console.log('Webpack production build for Rails'); // eslint-disable-line no-console
|
45
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Shown below are the defaults for configuration
|
2
|
+
ReactOnRails.configure do |config|
|
3
|
+
# Client bundles are configured in application.js
|
4
|
+
|
5
|
+
# Server rendering:
|
6
|
+
# Server bundle is a single file for all server rendering of components.
|
7
|
+
# It is important to set this to "" if you are not doing server rendering to avoid an extraneous log warning
|
8
|
+
# that the default file of server-bundle.js does not exist.
|
9
|
+
config.server_bundle_js_file = "app/assets/javascripts/generated/server-bundle.js" # This is the default
|
10
|
+
# increase if you're on JRuby
|
11
|
+
config.server_renderer_pool_size = 1
|
12
|
+
# seconds
|
13
|
+
config.server_renderer_timeout = 20
|
14
|
+
# If set to true, this forces Rails to reload the server bundle if it is modified
|
15
|
+
config.reload_server_js_every_request = Rails.env.development?
|
16
|
+
# For server rendering. This can be set to false so that server side messages are discarded.
|
17
|
+
# Default is true. Be cautious about turning this off.
|
18
|
+
config.replay_console = true
|
19
|
+
# Default is true. Logs server rendering messags to Rails.logger.info
|
20
|
+
config.logging_on_server = true
|
21
|
+
|
22
|
+
# The following options can be overriden by passing to the helper method:
|
23
|
+
|
24
|
+
# Default is false
|
25
|
+
config.prerender = false
|
26
|
+
# Default is false, meaning that you expose ReactComponents directly
|
27
|
+
config.generator_function = false
|
28
|
+
# Default is true for development, off otherwise
|
29
|
+
config.trace = Rails.env.development?
|
30
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# lib/tasks/assets.rake
|
2
|
+
# The webpack task must run before assets:environment task.
|
3
|
+
# Otherwise Sprockets cannot find the files that webpack produces.
|
4
|
+
# This is the secret sauce for how a Heroku deployment knows to create the webpack generated JavaScript files.
|
5
|
+
Rake::Task["assets:precompile"]
|
6
|
+
.clear_prerequisites
|
7
|
+
.enhance(["assets:compile_environment"])
|
8
|
+
|
9
|
+
namespace :assets do
|
10
|
+
# In this task, set prerequisites for the assets:precompile task
|
11
|
+
task compile_environment: :webpack do
|
12
|
+
Rake::Task["assets:environment"].invoke
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "Compile assets with webpack"
|
16
|
+
task :webpack do
|
17
|
+
sh "cd client && npm run build:client"
|
18
|
+
sh "cd client && npm run build:server"
|
19
|
+
end
|
20
|
+
|
21
|
+
task :clobber do
|
22
|
+
rm_rf "#{Rails.application.config.root}/app/assets/javascripts/generated/vendor-bundle.js"
|
23
|
+
rm_rf "#{Rails.application.config.root}/app/assets/javascripts/generated/client-bundle.js"
|
24
|
+
rm_rf "#{Rails.application.config.root}/app/assets/javascripts/generated/server-bundle.js"
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
{
|
2
|
+
"name": "react-webpack-rails-tutorial",
|
3
|
+
"version": "1.1.1",
|
4
|
+
"description": "Built using the react_on_rails generator. Allows you to run npm install from root.",
|
5
|
+
"main": "server.js",
|
6
|
+
"engines": {
|
7
|
+
"node": "4.2.0",
|
8
|
+
"npm": "3.3.6"
|
9
|
+
},
|
10
|
+
"scripts": {
|
11
|
+
"postinstall": "cd client && npm install",
|
12
|
+
"test": "rspec && (cd client && npm run lint)"
|
13
|
+
},
|
14
|
+
"repository": {
|
15
|
+
"type": "git",
|
16
|
+
"url": "https://github.com/shakacode/react-webpack-rails-tutorial.git"
|
17
|
+
},
|
18
|
+
"keywords": [
|
19
|
+
"react",
|
20
|
+
"tutorial",
|
21
|
+
"comment",
|
22
|
+
"example"
|
23
|
+
],
|
24
|
+
"author": "justin808",
|
25
|
+
"license": "MIT",
|
26
|
+
"bugs": {
|
27
|
+
"url": "https://github.com/shakacode/react-webpack-rails-tutorial/issues"
|
28
|
+
},
|
29
|
+
"homepage": "https://github.com/shakacode/react-webpack-rails-tutorial",
|
30
|
+
"dependencies": {}
|
31
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
// Wbpack configuration for server bundle
|
2
|
+
|
3
|
+
const webpack = require('webpack');
|
4
|
+
const path = require('path');
|
5
|
+
|
6
|
+
module.exports = {
|
7
|
+
|
8
|
+
// the project dir
|
9
|
+
context: __dirname,
|
10
|
+
entry: ['./app/bundles/HelloWorld/startup/serverGlobals'],
|
11
|
+
output: {
|
12
|
+
filename: 'server-bundle.js',
|
13
|
+
path: '../app/assets/javascripts/generated',
|
14
|
+
},
|
15
|
+
resolve: {
|
16
|
+
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx', 'config.js'],
|
17
|
+
alias: {
|
18
|
+
lib: path.join(process.cwd(), 'app', 'lib'),
|
19
|
+
},
|
20
|
+
},
|
21
|
+
plugins: [
|
22
|
+
new webpack.DefinePlugin({
|
23
|
+
'process.env': {
|
24
|
+
NODE_ENV: JSON.stringify('production'),
|
25
|
+
},
|
26
|
+
}),
|
27
|
+
],
|
28
|
+
module: {
|
29
|
+
loaders: [
|
30
|
+
{test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/},
|
31
|
+
|
32
|
+
// React is necessary for the client rendering:
|
33
|
+
{test: require.resolve('react'), loader: 'expose?React'},
|
34
|
+
{test: require.resolve('react-dom/server'), loader: 'expose?ReactDOMServer'},
|
35
|
+
],
|
36
|
+
},
|
37
|
+
};
|
data/lib/generators/react_on_rails/templates/bootstrap/app/assets/stylesheets/_bootstrap-custom.scss
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
// This file loads Bootstrap by importing components explicitly instead of doing `@import 'bootstrap';`
|
2
|
+
// Doing so allows for customization of exactly which components are imported.
|
3
|
+
// The components themselves are made available via bootstrap-sass (https://github.com/twbs/bootstrap-sass#sass)
|
4
|
+
|
5
|
+
// IMPORTANT: Make sure to keep the customizations defined in this file
|
6
|
+
// in-sync with the ones defined in client/bootstrap-sass.config.js.
|
7
|
+
|
8
|
+
// For a reference on customizations,refer to:
|
9
|
+
// https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/_bootstrap.scss
|
10
|
+
|
11
|
+
// If you are looking to merely change bootstrap variables from their default,
|
12
|
+
// you should instead declare them in client/assets/stylesheets/_post-bootstrap.scss
|
13
|
+
|
14
|
+
// Core variables and mixins
|
15
|
+
@import 'bootstrap/variables';
|
16
|
+
@import 'bootstrap/mixins';
|
17
|
+
|
18
|
+
// Reset and dependencies
|
19
|
+
@import 'bootstrap/normalize';
|
20
|
+
@import 'bootstrap/print';
|
21
|
+
@import 'bootstrap/glyphicons';
|
22
|
+
|
23
|
+
// Core CSS
|
24
|
+
@import 'bootstrap/scaffolding';
|
25
|
+
@import 'bootstrap/type';
|
26
|
+
@import 'bootstrap/code';
|
27
|
+
@import 'bootstrap/grid';
|
28
|
+
@import 'bootstrap/tables';
|
29
|
+
@import 'bootstrap/forms';
|
30
|
+
@import 'bootstrap/buttons';
|
31
|
+
|
32
|
+
// Components
|
33
|
+
@import 'bootstrap/component-animations';
|
34
|
+
@import 'bootstrap/dropdowns';
|
35
|
+
@import 'bootstrap/button-groups';
|
36
|
+
@import 'bootstrap/input-groups';
|
37
|
+
@import 'bootstrap/navs';
|
38
|
+
@import 'bootstrap/navbar';
|
39
|
+
@import 'bootstrap/breadcrumbs';
|
40
|
+
@import 'bootstrap/pagination';
|
41
|
+
@import 'bootstrap/pager';
|
42
|
+
@import 'bootstrap/labels';
|
43
|
+
@import 'bootstrap/badges';
|
44
|
+
@import 'bootstrap/jumbotron';
|
45
|
+
@import 'bootstrap/thumbnails';
|
46
|
+
@import 'bootstrap/alerts';
|
47
|
+
@import 'bootstrap/progress-bars';
|
48
|
+
@import 'bootstrap/media';
|
49
|
+
@import 'bootstrap/list-group';
|
50
|
+
@import 'bootstrap/panels';
|
51
|
+
@import 'bootstrap/responsive-embed';
|
52
|
+
@import 'bootstrap/wells';
|
53
|
+
@import 'bootstrap/close';
|
54
|
+
|
55
|
+
// Components w/ JavaScript
|
56
|
+
@import 'bootstrap/modals';
|
57
|
+
@import 'bootstrap/tooltip';
|
58
|
+
@import 'bootstrap/popovers';
|
59
|
+
@import 'bootstrap/carousel';
|
60
|
+
|
61
|
+
// Utility classes
|
62
|
+
@import 'bootstrap/utilities';
|
63
|
+
@import 'bootstrap/responsive-utilities';
|
@@ -0,0 +1,10 @@
|
|
1
|
+
// The Rails server imports this file via app/assets/stylesheets/application.css.scss
|
2
|
+
// The webpack HMR dev server loads this file via client/bootstrap-sass.config.js
|
3
|
+
|
4
|
+
// In either case, this file is loaded AFTER bootstrap has been loaded.
|
5
|
+
// This is where you can add your own styles and override bootstrap styles
|
6
|
+
// utilizing bootstrap variables and mixins.
|
7
|
+
|
8
|
+
.this-works {
|
9
|
+
color: orange !important;
|
10
|
+
}
|
data/lib/generators/react_on_rails/templates/bootstrap/client/assets/stylesheets/_pre-bootstrap.scss
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
// The Rails server imports this file via app/assets/stylesheets/application.css.scss
|
2
|
+
// The webpack HMR dev server loads this file via client/bootstrap-sass.config.js
|
3
|
+
|
4
|
+
// In either case, this file is loaded BEFORE bootstrap has been loaded.
|
5
|
+
// Use it to define variables BEFORE bootstrap loads. See http://getbootstrap.com/customize/
|
6
|
+
|
7
|
+
// This is a file that provides a fallback for `img-url` and fonts
|
8
|
+
@import 'react-on-rails-sass-helper';
|