vue-gwt icon indicating copy to clipboard operation
vue-gwt copied to clipboard

Is it possible to parse a .vue file using this project

Open kush96 opened this issue 5 years ago • 1 comments

Is there a way to parse .vue files? While exploring the project , i noticed there are a lot of parser classes within the project (TemplateParser being one). I wanted to know if it is possible to parse a vue file ,i.e make an AST or go over file token by token?

kush96 avatar Jun 26 '20 16:06 kush96

Hey @kush96 !

What do you mean by parsing Vue files? Basically Vue files group together the behaviour (script), template and styles.

In Vue GWT the behaviour has to be part of the .java file (because of limitation of the Java compiler/APT), and also to be more compatible with existing Java tooling.

This only leaves the template and style bit. Both of them are supported by Vue GWT in the .html file next to the Java class.

The reason we went with .html extension instead of .vue is to avoid IDE trying to understand Vue GWT templates as Vue JS ones (which wouldn't work as the component context is provided by the Java class, so it would basically keep telling you things are invalid).

If you only keep the template bit, then those are basically regular html file, with an optional style element for scoped CSS.

Does that make sense?

adrienbaron avatar Jun 26 '20 16:06 adrienbaron