vatson / rollup-plugin-vuetify

Vuetify autoloader 🤖
MIT License
20 stars 1 forks source link

support render functions #23

Closed dsvanidze closed 4 years ago

dsvanidze commented 4 years ago

extended plugin for vue components with render functions, which do not use templates. This fixes the error TypeError: Cannot read property 'trim' of undefined.

vatson commented 4 years ago

Hello @dsvanidze.

I got your point. I seem to have broken this functionality during the last refactoring.

I propose to skip extracting and transforming at all when there is no template. It's useless to transform code without directives and components. So extractAndTransform will come to this:

const extractAndTransform = (code, template = '') => {
  if (tyepof template !== 'string' || !template.trim()) { 
    return code;
  }

  const { directives, components } = extract(template)
  return transform(code, components, directives);
}

Please don't keep comments inside the code, this logic is obvious and doesn't require additional description.

Let me know if you are going to refactor your PR or I can add it myself.

Thank you very much for your contribution.

vatson commented 4 years ago

@dsvanidze

I just did it on my own. The changes will be released soon.

Thank you!

dsvanidze commented 4 years ago

Great! I am looking forward to the release!