Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Pass attributes back from each section on call to parseComponent #4914

Closed
zephraph opened this issue Feb 13, 2017 · 0 comments

Comments

@zephraph
Copy link
Contributor

When an external tool is using vue-template-compiler it would be very useful to have access to any attributes that are set on the template, script, or style sections. Custom blocks already do this, but the previously mentioned three don't.

This specifically applies to the parseComponent method.

In my use case I'm building a webpack loader to separate out component themes into a separate file.

Calling parseComponent on a file that contained the following...

<style theme="site" lang="stylus">

This would allow me to do processComponent(src).output.styles[0].attrs.theme in my tool. Without doing this I'm forced to do the parsing myself which seems unnecessary.

I would use custom blocks for this, but custom blocks don't have syntax highlighting in any editor that supports *.vue files.

yyx990803 pushed a commit that referenced this issue Feb 14, 2017
* Pass attributes to parseComponent

* Edited source in the right place, added test

* Back out changes made to the generated compiler build file

* Add a few more checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants