Comments (14)
Hi @afeld,
Just updated to Rails 3.2.6 in an example app and I am not seeing this. The Gemfile.lock
shows:
handlebars_assets (0.4.4)
sprockets (2.1.3)
rake assets:precompile
works as well. Is there something else I can look at to help?
from handlebars_assets.
I have the same problem in production on heroku
HomeController# (ActionView::Template::Error) "couldn't find file 'handlebars.runtime'\n (in /app/app/assets/javascripts/application.js:14)"
running
handlebars_assets (0.4.4)
sprockets (2.1.3)
from handlebars_assets.
Hi @ph,
Do you mind trying v0.6.2 (just released?)
from handlebars_assets.
yes its work now, thank you.
from handlebars_assets.
Awesome.
from handlebars_assets.
Hello. I work with @afeld. We are still seeing this problem in Rails 3.2.8 with handlebars_assets 0.6.2 and sprockets 2.1.3. Here is the first 10 lines of the backtrace:
Sprockets::FileNotFound: couldn't find file 'handlebars.runtime' (in /opt/jux/apps/jux/releases/20120821022836/app/assets/javascripts/app.combined.js:14)
[GEM_ROOT]/gems/sprockets-2.1.3/lib/sprockets/context.rb:100:in resolve' [GEM_ROOT]/gems/sprockets-2.1.3/lib/sprockets/context.rb:140:in
require_asset'
[GEM_ROOT]/gems/sprockets-2.1.3/lib/sprockets/directive_processor.rb:215:in process_require_directive' [GEM_ROOT]/gems/sprockets-2.1.3/lib/sprockets/directive_processor.rb:165:in
block in process_directives'
[GEM_ROOT]/gems/sprockets-2.1.3/lib/sprockets/directive_processor.rb:163:in each' [GEM_ROOT]/gems/sprockets-2.1.3/lib/sprockets/directive_processor.rb:163:in
process_directives'
[GEM_ROOT]/gems/sprockets-2.1.3/lib/sprockets/directive_processor.rb:97:in evaluate' [GEM_ROOT]/gems/tilt-1.3.3/lib/tilt/template.rb:76:in
render'
[GEM_ROOT]/gems/sprockets-2.1.3/lib/sprockets/context.rb:177:in block in evaluate' [GEM_ROOT]/gems/sprockets-2.1.3/lib/sprockets/context.rb:174:in
each'
from handlebars_assets.
Hi @tolsen,
Make sure the gem is in a group that is actually available when compiling assets in production; assets
should work.
from handlebars_assets.
It is in the assets group:
group :assets do
gem 'handlebars_assets'
gem 'uglifier'
gem 'yui-compressor'
end
The only thing we've changed is to upgrade Rails from 3.2.3 to 3.2.8 (@afeld tried 3.2.6).
from handlebars_assets.
Hi @tolsen,
Thanks for showing that. Debugging via comments is difficult at best :/
What happens when you run rake assets:precompile
locally?
The handlebars.runtime.js
file is located inside the gem at vendor/assets/javascripts
which is where Sprockets expects it when using Rails. If you want to move past this particular problem you can copy it to app/assets/javascripts
where it will be found without the gem. At that point, I would expect the problem to be that the .hbs
files are unknown, since it looks like there is an issue loading the gem.
from handlebars_assets.
asset compilation works fine locally. No errors.
Copying handlebars.runtime.js to vendor/assets/javascripts completely fixes the problem. There are no problems with the .hbs files.
We can do this as a workaround for now. But if you like I can further investigate this issue (besides, I'd rather not have to remember to manually copy the everytime we update handlebars_assets). Is there a load path for Sprockets that I can look at?
from handlebars_assets.
Hi @tolsen,
Yes, please do. That is not what I expected at all :/ Try checking the value of:
Sprockets::Environment.new.paths
from handlebars_assets.
Hi @leshill,
Sprockets::Environment.new.paths
is empty: []
I inserted logging code in a javascript asset:
/*
* <%= require('pp'); nil %>
* <%= Rails.logger.warn('PATH'); nil %>
* <%= Rails.logger.warn(PP.pp(Sprockets::Environment.new.paths, '')); nil %>
*/
which resulted in the following output in the log:
PATH
[]
Here's our asset configuration:
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
# Change the path that assets are served from
# config.assets.prefix = "/assets"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
#config.assets.precompile += [ /\.(js|css)(\.|$)/ ]
config.assets.precompile += [ /(^|\/)[^_\/][^\/]*\.css$/, /\.js$/ ]
config.assets.paths << "#{Rails.root}/app/assets/templates"
# Compress JavaScripts and CSS
config.assets.compress = true
# Choose the compressors to use
config.assets.js_compressor = :uglifier
config.assets.css_compressor = :yui
# using suggestion from https://github.com/rails/sass-rails/issues/63
config.after_initialize do
config.assets.css_compressor = nil
end
config.sass.style = :compressed
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs.
config.assets.digest = true
from handlebars_assets.
Hi @tolsen,
Hmmm, that is odd.
Noticed this line:
config.assets.paths << "#{Rails.root}/app/assets/templates"
Sprockets probably allows a String
; you could try a Pathname
:
config.assets.paths << Rails.root.join('app/assets/templates')
And as of this commit templates
is stripped from paths by default. You can change that with lib/handlebars_assets/config.rb
by setting path_prefix
as needed.
from handlebars_assets.
I got this error when running in production mode in my local desktop (OS X 10.8.3)
$ RAILS_ENV=production bundle exec rails s
The file console-8946dbb40970d6a70732335eb7242b1d.js only shows the following text
throw Error("Sprockets::FileNotFound: couldn't find file 'handlebars.runtime'\n (in {Rails.root}/app/assets/javascripts/console.js:1)")
The content of my console.js file is
//= require handlebars.runtime
//= require jquery
//= require jquery_ujs
//= require_tree ./templates/console
The gem is added in the assets group as follows
group :assets do
gem "handlebars_assets"
# more gems
end
and this is my current gemfile.lock if anyone wants to look into
https://gist.github.com/asumaran/01699d3f84333e3792fd
And there's no files in vendor/assets/javascripts/
The thing is that in development mode works well. Any thoughts?
UPDATE: I solved copying the handlebars.runtime file to vendor/assets/javascripts/ from the Gem folder and is working now but I don't know if this it is the correct way to solve this.
from handlebars_assets.
Related Issues (20)
- text/x-handlebars MIME Type not supported in sprocket
- Templates not compiling at all without .jst extension
- Accessing Assets Helpers From Templates HOT 2
- Sprockets method `register_engine` is deprecated. HOT 2
- NoMethodError: undefined method `[]' for nil:NilClass HOT 1
- Not an error but still nothing in view HOT 3
- Handlebars in attribute broken in Rails by CVE-2016-6316 fix HOT 1
- handlebars outputting the javascript in the view and not rendering it. HOT 2
- Update vendored js from v4.0.5 to v4.0.10 HOT 1
- help with building vendored files from source HOT 2
- 'app.config.assets.configure' is 'undefined' in 'handlebars_assets/engine.rb' HOT 6
- Partial HBS file is not compiled into 'HandlebarsTemplates' variable HOT 5
- HandlebarsTemplates object not defined without backing model HOT 6
- allow using assets from global path instead of relative path in tests HOT 3
- changelog is missing versions HOT 1
- [NODE-SECURITY-1164] Upgrade to handlebars 4.3.0+ HOT 3
- Update Handlebars to 4.4.5 or higher for Handlebars Vulnerability HOT 1
- Sprockets v4 support HOT 5
- Mention generic options config in readme HOT 4
- Haml 6.x Support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handlebars_assets.