Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

How to properly resolve assets path? #8

Closed
akitaonrails opened this issue Jun 29, 2014 · 13 comments
Closed

How to properly resolve assets path? #8

akitaonrails opened this issue Jun 29, 2014 · 13 comments

Comments

@akitaonrails
Copy link

The way it's built today it seems like the application.html will concatenate all the components dependencies, but it will not resolve the relative asset paths to proper #asset_path. I was wondering if adding bower-rails and trying the bower:resolve task would solve it. Or even using Polymer's own Vulcanize somehow.

Did you solve this already?

@akitaonrails
Copy link
Author

BTW, I've written an article in Brazilian Portuguese (http://www.akitaonrails.com/2014/06/29/usando-polymer-com-rails#.U7CKzhbY-zA). The last section tries to show how I would add bower-rails to the mix. And the code for the demo is in my public Github account: https://github.com/akitaonrails/polymer-test. It's failing to deploy to Heroku. If anyone can check it out, that would be great.

@akitaonrails
Copy link
Author

I just made some updated to my github public demo. bower-rails actually works and the bower:resolve task didn't solve what I wanted. The Polymer/core-icon-button can't show it's image icons when deployed in production but it depends on Polymer/core-icons, and this one renders the icons using inline SVG, so I don't know why the icons don't show up. Probably another relative path issue between components somehow.

@ahuth
Copy link
Owner

ahuth commented Jul 1, 2014

First of all, thanks for writing that blog post about Emcee and using Polymer with Rails! I never thought that something I made would be written about, and it's really cool to see it out there.

@akitaonrails
Copy link
Author

Sure, it's a nice project. If we can only figure out how to properly handle the component's assets that would be great. have you tried to integrate the polymer/vulcanize into the pipeline?

@ahuth
Copy link
Owner

ahuth commented Jul 1, 2014

I have been able to use Polymer with this. I have not used Vulcanize with it, though. This project is really the same thing as Vulcanize for use with Rails. It's really a competitor for Vulcanize and I'm not sure how this could be integrated with it.

To be honest, I'm a little bit slow and I don't quite understand the issue. Do you have a repository that illustrates the problem, or could you give me more detail?

Thanks!

@akitaonrails
Copy link
Author

Yeah, sorry, you mentioned that before. Could you take a look at my demo: https://github.com/akitaonrails/polymer-test ? It works in development. See that the search icon shows up in development but doesn't when I deploy in production (Heroku, for example). Any ideas?

@ahuth
Copy link
Owner

ahuth commented Jul 1, 2014

Ok, I understand now: the repo works correctly in development, but not when deployed to Heroku.

I've forked your repo, and I'll see if I can get it to work. Off the top of my head, I don't think bower-rails is necessary to get it to work.

@ahuth
Copy link
Owner

ahuth commented Jul 2, 2014

@akitaonrails I haven't done any testing for this issue, yet, but I'm wondering if the fix for issue #11 has solved this. Can you see if it works for you, now? The master branch is updated with the fix.

Thanks. If it doesn't work, I'll dig into it some more.

@ahuth
Copy link
Owner

ahuth commented Jul 2, 2014

Nevermind, I think I found the issue.

This line is in core-iconset-svg:

var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');

The HTML compressor attempts to remove javascript comments such as this: // comment.

This is stripping out everything after http:// in the first javascript example, leaving us with this:

var svg = document.createElementNS('http:

This is a syntax error, and the web components don't load right. I'll work on a fix for this.

@ahuth
Copy link
Owner

ahuth commented Jul 2, 2014

Looks like I've fixed it. Check it out here (for the time being).

I also re-wrote some of the test app because it doesn't need bower-rails. You can see that repo here. I can also submit a pull request, if you want it.

To convert it, I got rid of all the node stuff, removed the vendor/assets/components symlink and renamed bower_components to just components. Then, you don't need the build packs or the bower-rails gem. bower install will still put stuff in the correct directory, and everything will work fine.

@ahuth ahuth closed this as completed Jul 2, 2014
@akitaonrails
Copy link
Author

Ah, nice, please do send me the PR, I'll update my demo and my post to reflect this. And I agree, bower-rails can be removed.

@akitaonrails
Copy link
Author

Never mind, already added your fork as a remote and pulled to mine :-)

@ahuth
Copy link
Owner

ahuth commented Jul 5, 2014

Cool! I did not know you could do that. Thanks again for raising 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

2 participants