alchaplinsky / polymer-rails

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

Updated component generator to work with nested paths #93

Closed LasseSviland closed 7 years ago

LasseSviland commented 7 years ago

Updated the component generator to be able to generate components in directories, the same way the model/controller generator works in rails.

rails g polymer:component my-sub-directory/component-name

with the changes, the generator will generate the component files in the correct directory

app/assets/components/my-sub-directory/component-name
app/assets/components/my-sub-directory/component-name/component-name.html
app/assets/components/my-sub-directory/component-name/component-name.js
app/assets/components/my-sub-directory/component-name/component-name.css

The current generator would create an extra directory inside the component directory, and have wrong references in the js file. The current generator will create.

app/assets/components/my-sub-directory/component-name/my-sub-directory
app/assets/components/my-sub-directory/component-name/my-sub-directory/component-name.html
app/assets/components/my-sub-directory/component-name/my-sub-directory/component-name.js
app/assets/components/my-sub-directory/component-name/my-sub-directory/component-name.css