New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript inserted into asset path produces errors #4050

Closed
nickrivadeneira opened this Issue Dec 4, 2013 · 9 comments

Comments

Projects
None yet
2 participants
@nickrivadeneira

To set up Spree, I followed the instructions and used the Spree installer. A couple of folders were created in my asset path containing manifest files (admin/all.js, store/all.js, etc.). Because Rails' default manifest (application.js) contains require_tree ., the Spree assets were automatically being included in my applications layout, even outside of the store. While the Spree storefront has all necessary context for Spree's assets, my app's layout does not, so I was receiving errors related to Spree.translations being undefined.

The solution was to change require_tree . in application.js to require_directory . so that it would no longer automatically include Spree assets everywhere. It seems to me that this shouldn't be necessary and that Spree's installer should not break a default Rails config for pages other than the storefront.

@radar

This comment has been minimized.

Show comment
Hide comment
@radar

radar Dec 6, 2013

Member

Thanks for bringing that up @nickrivadeneira. I've seen this happen too.

Do you have any suggested fixes for this problem at this point in time?

Member

radar commented Dec 6, 2013

Thanks for bringing that up @nickrivadeneira. I've seen this happen too.

Do you have any suggested fixes for this problem at this point in time?

@nickrivadeneira

This comment has been minimized.

Show comment
Hide comment
@nickrivadeneira

nickrivadeneira Dec 6, 2013

I haven't tested if this works, but it might be possible to store it in vendor/assets instead.

I haven't tested if this works, but it might be possible to store it in vendor/assets instead.

@radar

This comment has been minimized.

Show comment
Hide comment
@radar

radar Dec 9, 2013

Member

I think that would be a pretty reasonable expectation, given that it's not styling from your application, but from some gem that you're depending on. I will change this behaviour in master and 2-1-stable now.

Member

radar commented Dec 9, 2013

I think that would be a pretty reasonable expectation, given that it's not styling from your application, but from some gem that you're depending on. I will change this behaviour in master and 2-1-stable now.

@nickrivadeneira

This comment has been minimized.

Show comment
Hide comment
@nickrivadeneira

nickrivadeneira Dec 9, 2013

Cool beans 😎 Thanks!

Cool beans 😎 Thanks!

@radar

This comment has been minimized.

Show comment
Hide comment
@radar

radar Dec 9, 2013

Member

Actually, this is probably too big of a change to land on 2-1-stable. I think it should only go on the master branch.

Member

radar commented Dec 9, 2013

Actually, this is probably too big of a change to land on 2-1-stable. I think it should only go on the master branch.

@radar

This comment has been minimized.

Show comment
Hide comment
@radar

radar Dec 9, 2013

Member

@nickrivadeneira Can you please try out my master branch and let me know if that works for you?

Member

radar commented Dec 9, 2013

@nickrivadeneira Can you please try out my master branch and let me know if that works for you?

@nickrivadeneira

This comment has been minimized.

Show comment
Hide comment
@nickrivadeneira

nickrivadeneira Dec 9, 2013

Got an error from vendor/assets/javascripts/spree/frontend/all.js that it could find no such file spree/frontend:

Sprockets::FileNotFound at /
couldn't find file 'spree/frontend'
  (in /Users/..../vendor/assets/javascripts/spree/frontend/all.js:10)

That line read //= require spree/frontend. I didn't look too hard, but I believe this is appended in the generator script but is probably unnecessary since right below it, there's a //= require_tree . that would do the same thing. Deleting it removed the error.

Once that was resolved, everything seemed to be in working order.

Got an error from vendor/assets/javascripts/spree/frontend/all.js that it could find no such file spree/frontend:

Sprockets::FileNotFound at /
couldn't find file 'spree/frontend'
  (in /Users/..../vendor/assets/javascripts/spree/frontend/all.js:10)

That line read //= require spree/frontend. I didn't look too hard, but I believe this is appended in the generator script but is probably unnecessary since right below it, there's a //= require_tree . that would do the same thing. Deleting it removed the error.

Once that was resolved, everything seemed to be in working order.

@radar radar closed this in cfbd0f3 Dec 10, 2013

radar added a commit that referenced this issue Dec 10, 2013

@radar

This comment has been minimized.

Show comment
Hide comment
@radar

radar Dec 10, 2013

Member

@nickrivadeneira I believe I have fixed that error now. Please try again.

Member

radar commented Dec 10, 2013

@nickrivadeneira I believe I have fixed that error now. Please try again.

@nickrivadeneira

This comment has been minimized.

Show comment
Hide comment
@nickrivadeneira

nickrivadeneira Dec 10, 2013

Did some limited testing and it seems to be working fine.

Did some limited testing and it seems to be working fine.

radar added a commit to spree-contrib/spree_fancy that referenced this issue Dec 12, 2013

peterberkenbosch added a commit to spree-contrib/spree_i18n that referenced this issue Dec 13, 2013

peterberkenbosch added a commit to spree/spree_auth_devise that referenced this issue Dec 16, 2013

radar added a commit to spree/spree-guides that referenced this issue Dec 17, 2013

radar added a commit to spree-contrib/spree_i18n that referenced this issue Dec 17, 2013

mvidaurre added a commit to AgilTec/spree_fancy that referenced this issue Dec 17, 2013

mvidaurre added a commit to AgilTec/spree_fancy that referenced this issue Dec 17, 2013

mvidaurre added a commit to AgilTec/spree_fancy that referenced this issue Dec 18, 2013

radar added a commit to spree-contrib/spree_fancy that referenced this issue Jan 6, 2014

radar added a commit to spree-contrib/spree-product-assembly that referenced this issue Jan 7, 2014

radar added a commit to spree/spree_gateway that referenced this issue Jan 31, 2014

cbrunsdon pushed a commit to StemboltHQ/spree that referenced this issue Mar 2, 2014

CClerville pushed a commit to dotandbo/spree_gateway that referenced this issue May 2, 2014

brianwells added a commit to brianwells/spree_banner that referenced this issue Sep 7, 2014

brianwells added a commit to brianwells/spree_news_items that referenced this issue Sep 7, 2014

brianwells added a commit to brianwells/spree_product_sounds that referenced this issue Sep 7, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment