Js-beautify: support vuejs

Created on 8 Mar 2017  路  12Comments  路  Source: beautify-web/js-beautify

Settings

Example:
switch (languageId) { case 'scss': languageId = 'css'; case 'css': beatiFunc = jsbeautify.css; break; case 'json': languageId = 'javascript'; case 'javascript': beatiFunc = jsbeautify.js; break; case 'html': beatiFunc = jsbeautify.html; case 'vue': beatiFunc = jsbeautify.html; break; default: showMesage('Sorry, this language is not supported. Only support Javascript, CSS and HTML.'); break;

enhancement

All 12 comments

It can just fall through

case 'html':
case 'vue':
    beatiFunc = jsbeautify.html;

@lizhongyi @jimmywarting
You're writing the code you want? How about about PR?

@lizhongyi Why closed?

@bitwiseman I think they may not have enough free time, please forgive us. :(

Any progress on this? Not many tools out there as good as or as widely used as jsbeautify and not supporting Vue is a huge headache.

@lonerdottie - It looks like this would a straightforward PR. Make the change suggested above, add a few tests. I doubt it would be full support, but it would be something.

@lonerdottie - Actually, it is unclear to me what part of the code it referred to above. Are you using http://jsbeautifier.org or a specific editor/plugin? What happens to your vuejs code when you put it in http://jsbeautifier.org ?

@bitwiseman take a look at this code for example and run it through. The obvious issue when running it in jsbeautifier.org is that it ignores everything within the 'template' tag.
https://gist.github.com/lonerdottie/5f47b66dccd8c3ca6a2528adc06fcba4

@lonerdottie Yeah, we treat template as "unformatted". (see https://github.com/beautify-web/js-beautify/blob/master/js/src/html/beautifier.js#L99) . You could try overriding that setting.

What other issues do you see?

How does one remove the template tag from the unformatted tags for HTML beautifying?
The documentation specifies howto set the tags on the command line but not the .jsbeautifyrc file.

@xorbis @lonerdottie
I think this is fixed in 1.9.0-beta2 (possibly earlier). Can you take a look?

Can't test on my side we switched to eslint beautifying.

Was this page helpful?
0 / 5 - 0 ratings