bjarosze / riot_js-rails Goto Github PK
View Code? Open in Web Editor NEWMuut Riot integration with Rails
Muut Riot integration with Rails
The rubygem version is quite outdated (just saw it is still using class selector).
Please release and push a new version to rubygems.org.
I can do this if you need help.
Can you release a new version of the gem with the Turbolinks 5 support?
/cc @BradHudson
Maybe a support for Jade (.js.tag.jade
) and Skim (.js.tag.skim
) could be implemented at riot_js-rails
level?
If a <script type="es6">
tag is used, Riot will need Babel to work.
I get this error while trying to compile assets: ExecJS::ProgramError: Unexpected character '#'
.
After checking the source code, I found that in node_runner
there is a strange line #{source}
. Looks like Ruby interpolation.
How should I fix this issue and start using riotjs?
(function(program, execJS) { execJS(program); })(function(module, exports, console) {
#{source}
}, function(program) {
var output, print = function(string) {
process.stdout.write('' + string);
};
try {
result = program();
if (typeof result == 'undefined' && result !== null) {
print('["ok"]');
} else {
try {
print(JSON.stringify(['ok', result]));
} catch (err) {
print('["err"]');
}
}
} catch (err) {
print(JSON.stringify(['err', '' + err]));
}
});
My Rails app environment settings:
Rails.application.configure do
config.cache_classes = true
config.eager_load = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.assets.js_compressor = :uglifier
config.assets.compile = false
config.assets.digest = true
config.log_level = :warn
config.assets.precompile << %r{(^[^_\/]|\/[^_])[^\/]*$}
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.log_formatter = ::Logger::Formatter.new
config.active_record.dump_schema_after_migration = false
config.active_job.queue_adapter = :sidekiq
end
If the user does not have the particular node module installed, the gem raises an error TypeError: Cannot read property 'renderSync' of null
, without explaining why it is happening.
Was waiting for this!
This code:
<example-tag>
<h1>
{ header }
</h1>
<script type="text/coffeescript">
@header = opts.header ? "This is a header text"
</script>
</example-tag>
# index.html.erb
<%= riot_component(:div, :example_tag, { :header => 'Some header' }) %>
raises an error in the javascript console:
Uncaught TypeError: Cannot read property 'class' of undefined
at mountTo (riot.self-553c20b….js?body=1:2489)
at pushTagsTo (riot.self-553c20b….js?body=1:1872)
at each (riot.self-553c20b….js?body=1:939)
at pushTagsTo (riot.self-553c20b….js?body=1:1877)
at Object.mount$1 [as mount] (riot.self-553c20b….js?body=1:1927)
at Object.mount (riot_rails.self-23d2256….js?body=1:16)
at HTMLDivElement.<anonymous> (riot_rails.self-23d2256….js?body=1:28)
at Function.each (jquery.self-bd7ddd3….js?body=1:371)
at jQuery.fn.init.each (jquery.self-bd7ddd3….js?body=1:138)
at Object.mountAll (riot_rails.self-23d2256….js?body=1:27)
mountTo @ riot.self-553c20b….js?body=1:2489
pushTagsTo @ riot.self-553c20b….js?body=1:1872
each @ riot.self-553c20b….js?body=1:939
pushTagsTo @ riot.self-553c20b….js?body=1:1877
mount$1 @ riot.self-553c20b….js?body=1:1927
mount @ riot_rails.self-23d2256….js?body=1:16
(anonymous) @ riot_rails.self-23d2256….js?body=1:28
each @ jquery.self-bd7ddd3….js?body=1:371
each @ jquery.self-bd7ddd3….js?body=1:138
mountAll @ riot_rails.self-23d2256….js?body=1:27
(anonymous) @ riot_rails.self-23d2256….js?body=1:35
fire @ jquery.self-bd7ddd3….js?body=1:3233
fireWith @ jquery.self-bd7ddd3….js?body=1:3363
ready @ jquery.self-bd7ddd3….js?body=1:3583
completed @ jquery.self-bd7ddd3….js?body=1:3618
as in
riot_js-rails
0.7.0Rails
5.0.1Still on 2.2.4
If for example I load a new HTML inside a modal that contain a riot's tag, it won't be mounted like the tags on the initial tag.
This is useful for rails' HTML ajax load.
Just like react-rails, implement an option to riot_component (or maybe make that the default) to fully render the component on the server-side.
Well, I have added the gem to the gemfile, runned bundle and added riot and riot_rails to the application.js (in my case, application.coffee).
Now I am struggling to add the tag I have just created to the application.coffee file. I've added it to the root of my assets/javascripts
folder with the name mytag.tag
and then required it like #= mytag
, but that does not seem to work, event after adding the js.tag
extension.
Any help?
Just as react-rails suggested, recommend therubyracer as it has a much better performance for executing javascript
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.