Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

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

Open
jejacks0n opened this issue May 21, 2012 · 8 comments
Open

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

jejacks0n opened this issue May 21, 2012 · 8 comments

Comments

@jejacks0n
Copy link

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?

@dnagir
Copy link
Owner

dnagir commented May 21, 2012

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.

@jejacks0n
Copy link
Author

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.

@dnagir
Copy link
Owner

dnagir commented May 21, 2012

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.

@jejacks0n
Copy link
Author

So, I would expect the fix is to remove the jst portion of the filename. I'll try and figure that out tomorrow if I can.

Thanks.

On May 20, 2012, at 9:48 PM, Dmytrii Nagirniak wrote:

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.


Reply to this email directly or view it on GitHub:
#7 (comment)

@dnagir
Copy link
Owner

dnagir commented May 21, 2012

Yes, with additional spec looking like:

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

@nickl-
Copy link

nickl- commented Sep 22, 2013

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

@SeanRoberts
Copy link

I am still having this issue with Rails 4

@SeanRoberts
Copy link

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants