-
-
Notifications
You must be signed in to change notification settings - Fork 631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to work without sprockets #671
Conversation
@fc-arny can you explain the use case for not using sprockets? If you're confident others can benefit from this change, please create a changelog entry and rebase your changes on top of master. https://github.com/shakacode/react_on_rails/blob/master/CONTRIBUTING.md |
@justin808 my goal is use only one tool for compiling assets. Using webpack for compiling js, then pass bundle to application.js and then flow through sprockets' process is very slow and not transparent. Now we use react_on_rails for component rendering and https://github.com/mipearson/webpack-rails(+ stats-webpack-plugin) for inclusion code on page. I'm not sure we need put this case in changelog. I think we can implement some ideas from webpack-rails and create better completed solution later. |
Sounds good. Please rebase your changes on top of master and get CI to pass. Please add a CHANGELOG.md entry and if possible, add some test. |
@fc-arny Wow, this is really great. What I'd LOVE to see is a file in the docs/additional-reading directory on how you use the github.com/mipearson/webpack-rails package with React on Rails. How about we call the file: docs/additional-reading/rails-without-sprockets Are you able to create a simple test deployment to Heroku with this setup? Please provide as much as you can regarding what you learned and I'll contribute with you. |
@justin808 It's really cool! Let's start with this simple approach 👍 |
@fc-arny Any progress on this one? |
@justin808 in progress. Setup sample application and creating doc with this flow. |
@fc-arny I'm going to push out a new release later today. If this is ready, I'll include it. |
@fc-arny Anything I can to help with this one? |
@justin808 sorry for this... just need some free time (3 days i this) and i will create sample application and documentation. |
@fc-arny I'm looking forward to this one. Let me know if I can help. Please be sure to see https://github.com/shakacode/react_on_rails/blob/master/CONTRIBUTING.md for some details like adding tests, updating the CHANGELOG.md, etc. |
@fc-arny Anything I can help you with to get this to completion? |
@fc-arny @rupurt, I'd like to know which of the approaches to advocate
|
@justin808 I'd say you want a combination of both. It makes sense to guard the sprockets requires if the gem is not installed, but I would want to keep sprockets working for legacy apps so they can be gradually transitioned. |
@fc-arny Let me know if this is ready for merge, or if you had some more docs that you wanted to add. |
CHANGELOG.md
Outdated
@@ -4,7 +4,8 @@ All notable changes to this project's source code will be documented in this fil | |||
Contributors: please follow the recommendations outlined at [keepachangelog.com](http://keepachangelog.com/). Please use the existing headings and styling as a guide, and add a link for the version diff at the bottom of the file. Also, please update the `Unreleased` link to compare to the latest release version. | |||
|
|||
## [Unreleased] | |||
*Please add entries here for your pull requests.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fc-arny Please don't remove this line. Let me know if this is all ready for merge otherwise.
@fc-arny Is this one ready? I'm going to do a release on Saturday. |
@fc-arny Please update to master to fix the conflict. |
Reviewed 2 of 2 files at r1. Comments from Reviewable |
In 6.5.1. |
This enables omitting Sprockets. Sprockets' tasks (assets:*) not available if you do not require 'sprockets/railtie' and when you try run some rake task got a message: ```bash ReactOnRails: Set generated_assets_dir to default: app/assets/webpack Running via Spring preloader in process 18586 rake aborted! Don't know how to build task 'assets:precompile' (see --tasks) /Users/arthur/.rvm/gems/ruby-2.3.3/gems/react_on_rails-6.3.4/lib/tasks/assets.rake:35:in `<top (required)>' ... ``` My application config ```ruby # frozen_string_literal: true require_relative 'boot' require 'rails' # Pick the frameworks you want: require 'active_model/railtie' require 'active_job/railtie' require 'active_record/railtie' require 'action_controller/railtie' require 'action_mailer/railtie' require 'action_view/railtie' # require 'sprockets/railtie' Bundler.require(*Rails.groups) module My class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s] config.i18n.default_locale = :ru config.i18n.enforce_available_locales = true config.time_zone = 'Moscow' config.middleware.use I18n::JS::Middleware end end ```
…e-redux-div-to-json-script * origin/master: (42 commits) Release 6.5.1 Update CHANGELOG.md Ability to work without sprockets (#671) Change Turbolinks unmount event from before-visit to before-render (#709) Update generator.md Update README.md Update i18n.md Small formatting tweak Release 6.5.0 Updated CHANGELOG.md Update README.md Update README.md Update README.md Fix incorrect "this" references of Node.js SSR Remove reference to heroku-buildpack-multi (#698) Small fixes to achieve reproducible build (#661) Update PROJECTS.md Doc Changes for links on gitbook Update README.md Added property renderedHtml to return gen func ...
Sprockets' tasks (assets:*) not available if you do not require 'sprockets/railtie' and when you try run some rake task got a message:
My application config
This change is