thefron / dust-rails Goto Github PK
View Code? Open in Web Editor NEWUse dust.js with rails
Use dust.js with rails
Hi,
I'm really looking forward to trying out your dust-rails gem!
Followed the README to the dot - included in Gemfile, bundle installed, added a demo.js.dust file to a new templates folder under app/assets/javascripts and added the 2 requires, and the dust.render-call to application.js
I'm
[rails 3] bundle show rails
/Users/walther/.rvm/gems/ruby-1.9.2-p290@oxenserver/gems/rails-3.2.1
[rails 3] bundle show dust-rails
/Users/walther/.rvm/gems/ruby-1.9.2-p290@oxenserver/gems/dust-rails-0.3.0
The trace (well, trace is perhaps somewhat misleading but anyways) shows
ActionView::Template::Error (couldn't find file 'dust-core'
(in /Users/walther/Documents/RailsProjects/oxen.3.2/app/assets/javascripts/application.js:12)):
14: %link{ href: 'http://fonts.googleapis.com/css?family=Norican', rel:'stylesheet', type:'text/css'}
15: / %link{ href:'http://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic|Ubuntu+Condensed', rel:'stylesheet', type: 'text/css'}
16: = stylesheet_link_tag "application"
17: = javascript_include_tag "application"
18: = csrf_meta_tags
19: = belongs_meta_tags
20:
app/views/layouts/application.haml:17:in `_app_views_layouts_application_haml__1776395587685589947_70176145429920'
app/controllers/abstract_actions_controller.rb:44:in `index'
Rendered /Users/walther/.rvm/gems/ruby-1.9.2-p290@oxenserver/gems/actionpack-3.2.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (5.6ms)
Rendered /Users/walther/.rvm/gems/ruby-1.9.2-p290@oxenserver/gems/actionpack-3.2.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.6ms)
Rendered /Users/walther/.rvm/gems/ruby-1.9.2-p290@oxenserver/gems/actionpack-3.2.1/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (11.5ms)
My app/assets/javascripts/application.js looks like this:
//
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require bootstrap
//= require jquery_widgets
//= require dust-core
//= require_tree ./templates
//= require_tree .
//= require desktop
//
$(function() {
$('a[data-code]').click(function() {
$('pre').toggle();
});
$('label').hover(function() {
$(this).parent().find('p.help-block').toggle();
});
});
dust.render("messages", {name: "Fred", count: 10}, function(err, out) {
console.log(out);
});
Any ideas?
I am getting the following
$ bin/rake assets:precompile
/Users/jpaas/.rvm/rubies/ruby-1.9.3-p327/bin/ruby bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Unexpected token: operator (<) (line: 18169, col: 1, pos: 543284)
undefined
My project only has 1 dust template and this error goes away as soon as I remove it from the application.js manifest. So whatever it's generating, precompile doesn't like it.
This is pretty serious problem because I can't deploy to heroku without precompilation. :(
suddently assets:precompile breaks when deploying on heroku, states that helpers are undefined.
I am trying to change the template root path by setting
config.dust.template_root = 'app/assets/javascripts/' in application.rb
The config does not seem to be taking hold though.
Also template that I have placed in app/assets/javascripts/templates seems to get registered as "templates/feed_block" instead of "feed_block"
I am using rails 3.2.0
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.