Menu
Libraries |
Category

svelte-mode

  • Emacs major mode specifically designed for .svelte files, based on mhtml-mode
  • Requires Emacs version 26 or higher
  • Supports Svelte directives and blocks
  • Integrates with other modes for different languages within Svelte components:
    • typescript-mode for <script lang="ts">
    • sass-mode for <style lang="sass">
    • pug-mode for <template lang="pug">
    • coffee-mode for <script lang="coffee">
  • Works with emmet-mode for HTML/CSS expansion
  • Includes JavaScript/CSS as submode in html-mode

Customization options:

  • svelte-basic-offset: Controls basic indentation level (defaults to sgml-basic-offset)
  • svelte-tag-relative-indent: Whether script/style bodies indent to their tags (default: true)
  • svelte-display-submode-name: Shows active submode in status line (default: false)

Special feature:
Includes a configuration workaround for case-sensitive tag handling, particularly useful for Svelte components that share names with HTML tags (like Link components).

Alternative: For tree-sitter support, see svelte-ts-mode .

sveltemodesyntaxindentemacssvelte-mode

Comments