Skip to content
Format your svelte components using prettier.
Branch: master
Clone or download
Latest commit 0debb22 Jul 11, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci add circle ci May 26, 2019
src Merge pull request #47 from clitetailor/feat/await-block Jul 11, 2019
test Merge pull request #47 from clitetailor/feat/await-block Jul 11, 2019
.gitignore use rollup Aug 23, 2018
.npmignore use rollup Aug 23, 2018
.prettierrc first commit Aug 22, 2018
README.md feat: add strict mode for print html Jun 13, 2019
ava.config.js add testing framework Aug 23, 2018
package.json v0.7.0 Jul 11, 2019
rollup.config.js use rollup Aug 23, 2018
tsconfig.json use rollup Aug 23, 2018
wallaby.js add wallaby Aug 23, 2018
yarn.lock add test for html entities May 26, 2019

README.md

Prettier for Svelte 3 components

Format your svelte components using prettier.

Features

  • Format your html, css, and javascript using prettier
  • Format Svelte syntax, e.g. each loops, if statements, await blocks, etc.
  • Format the javascript expressions embedded in the svelte syntax
    • e.g. expressions inside of {}, event bindings on:click="", and more

How to install

npm i --save-dev prettier-plugin-svelte prettier

How to use

Install prettier-plugin-svelte as a dev dependency in your project.

Then format your code using prettier cli. You may need to add --plugin-search-dir=.

prettier --write --plugin-search-dir=. ./**/*.html

Options

svelte-sort-order Sort order for scripts, styles, and markup. Defaults to scripts-styles-markup.

prettier --write --svelte-sort-order scripts-markup-styles ./**/*.svelte

svelte-strict-mode Enable more strict syntax for HTML. Defaults to false.

Main difference in strict mode:

You can’t perform that action at this time.