-
-
Notifications
You must be signed in to change notification settings - Fork 626
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
Clean up, pretty up code for helper, move some code to inclusion file. #32
Comments
@justin808 For indentation in heredoc, we could use http://api.rubyonrails.org/classes/String.html#method-i-strip_heredoc to remove white spaces from beginning. |
@samnang We originally did it that way, but it's super hard as well for changing the indentation. The code is also going to be slightly faster not using it. On a somewhat related note, we should maybe put some of the code for the client side into a file included in application.js. Take a look at: https://github.com/shakacode/react_on_rails/blob/master/spec/dummy/spec/sample_generated_js/client-generated.js I think we only need a few parameters to a client side method call:
|
I think that moving javascript into .js file which should be included in Rails' application.js is a good idea. If we need to add some runtime logic, than we can change extension to .js.erb and do some preprocessing for javascript code. And even cache it all or partially for performance gain. |
@szyablitsky Let me know if you'd like to do this. Or anybody else does, please let me know. |
@samnang and I made amazing progress from this today. |
Fixed by #44. |
The code right now in the react_on_rails gem looks horrible due to trying to preserve the correct white space. Here's the generated code:
And here's the files that generate it:
@samnang @alexfedoseev @mapreal19 @josiasds Any ideas on how best to refactor this?
BTW -- be super careful before accepting any commits that might mess with this formatting.
@Johnnycus Let's write a unit test that verifies that the generated JS stays the same, and that will enable us to do some refactoring.
The text was updated successfully, but these errors were encountered: