alchaplinsky / polymer-rails

Polymer and web components for Ruby on Rails
MIT License
286 stars 80 forks source link

Exclude .map files for Sprockets #74

Closed goozler closed 6 years ago

goozler commented 8 years ago

Hi!

I've got some problems in production with polymer-rails. The component paper-dropdown uses animations and it is has a .js.map file.

Sometimes while compile assets the map file goes first in file_list array here. As a result the source of this file is placed to the script tag in application.html instead of desired content.

I just made a quick fix for that. Could you review it and make some changes in the gem?

Thank you in advance!

alchaplinsky commented 8 years ago

Not sure that this is the place to solve such issue (*.map files should not be in your assets folder if you don't want to compile them).. @goozler How do you install paper elements for your project?

goozler commented 8 years ago

Just like here via bower. It installs and uses web-animations-js which has a *.map files.

goozler commented 8 years ago

So, my first decision was to remove *.map files from this folder. But it's not pretty cool to do it after every component update

alchaplinsky commented 8 years ago

I agree that removing all not needed files after installing component via bower is a bit annoying. However, we cannot filter out all junk files that might get into component's folder on gem level. Simply because we don't know which files developer wants to be compiled and which he doesn't.

In your case .map file is not desirable. But what is someone create a component which contains .map or .wtf file which should be compiled to component-name.html ?

The workaround for this is to install polymer-elements via gem polymer-elements-rails, where all not desirable files are already removed from sources.