Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

GET file.hamljs.js?body=1 404 (Not Found) #7

Open
jejacks0n opened this Issue · 8 comments

4 participants

Jeremy Jackson Dmytrii Nagirniak Nick Lombard Sean Roberts
Jeremy Jackson

Rails 3.2.2
gem 'ruby-haml-js', git: 'https://github.com/dnagir/ruby-haml-js.git'

When you require the templates (or views), the request turns into file.hamljs.js -- while sprockets will actually serve it as file.js.

For instance:

= require file

results in file.hamljs.js

This seems to be a problem with how Sprockets.register_engine '.hamljs' is working, so I'll be doing some digging on where the bug is inside sprockets. Have you seen this before?

Dmytrii Nagirniak
Owner
dnagir commented

Not sure exactly what you mean.

The spec shows that file named sample.jst.hamljs is happy to be served as sample.js.

Have you tried naming file.jst.hamljs instead of file.hamljs as desribed in the The usage?

But I haven't used it for a while and there could be some changes in Sprockets.

Jeremy Jackson

Thanks, and yeah, the spec is exactly correct. I have the file named file.jst.hamljs, and it is in fact available at file.js, so your spec is correct.

However, using the sprockets require statement at the top of a file:

//= require file

(in development mode) references file.hamljs.js -- and not file.js like your spec is asserting.

Make more sense? It's clearly an issue in sprockets, but since it effects this gem I figured I'd open it -- since you may have more background than myself.

Dmytrii Nagirniak
Owner
dnagir commented

Ok. Yes, I see the issue.

I think there's a missing spec that ensures that the correct path is generated (opposite to serving).

Unfortunately I don't have time to dig into that. But will gladly accept a fix for this.

Jeremy Jackson
Dmytrii Nagirniak
Owner
dnagir commented

Yes, with additional spec looking like:

it "generate asset path" do
  asset_path_for('sample').should == "/assets/sample.js?body=1"
end
Nick Lombard

This does not appear to be an issue anymore and even works as expected with rails 4 asset pipeline.

Sean Roberts

I am still having this issue with Rails 4

Sean Roberts

Scratch that, changing my Gemfile to reference the version on Git and deleting my tmp/cache folder fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.