Last active
September 24, 2017 09:57
-
-
Save samtgarson/6cce2b7df9f5ba6c5b0ccf722c3fe588 to your computer and use it in GitHub Desktop.
Vue support for prettier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn prettier --print-width 80 --no-semi --single-quote --parser parse5 --write example.vue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<example> | |
<p>{{ code }}</p> | |
<ul> | |
<li v-for="item in array">{{ item }}</li> | |
</ul> | |
</example> | |
</template> | |
<script> | |
export default { | |
name: 'example', | |
data: () => ({ array: [1, 2, 3] }), | |
props: { | |
code: { | |
type: String, | |
required: true | |
} | |
} | |
} | |
</script> | |
<style> | |
.example { | |
background: red; | |
} | |
li { | |
list-style-type: none; | |
} | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<example> | |
<p>{{ code }}</p> | |
<ul> | |
<li v-for="item in array">{{ item }}</li></ul> | |
</example> | |
</template> | |
<script> | |
export default { | |
name: 'example', | |
data: () => ({ array: [1, 2, 3] }), | |
props: { | |
code: { type: String, | |
required: true | |
} | |
} | |
} | |
</script> | |
<style> | |
.example { | |
background: red; | |
} | |
li { | |
list-style-type: none | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The command seems to work correctly for the
<script>
section, however:<template>
section<style>
section.I'm not sure if
prettier
supportsindented
syntax Sass and Pug or not so that could be the issue?