# svelte-preprocess **Repository Path**: mirrors_sveltejs/svelte-preprocess ## Basic Information - **Project Name**: svelte-preprocess - **Description**: A ✨ magical ✨ Svelte preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, Coffeescript, TypeScript, Pug and much more. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-26 - **Last Updated**: 2025-08-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Svelte Preprocess > A [Svelte](https://svelte.dev) preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, CoffeeScript, TypeScript, Pug and much more.
- [What is it?](#what-is-it) - [Getting Started](docs/getting-started.md) - [Usage](docs/usage.md) - [Migration Guide](docs/migration-guide.md) - [Preprocessing](docs/preprocessing.md) - [Preprocessors](docs/preprocessing.md#preprocessors) - [Features](#features) - [Template tag](#template-tag) - [External files](#external-files) - [Global style](#global-style) - [Modern JavaScript syntax](#modern-javascript-syntax) - [Replace values](#replace-values) - [Built-in support for commonly used languages](#built-in-support-for-commonly-used-languages) ## What is it? `Svelte`'s own parser understands only JavaScript, CSS and its HTML-like syntax. To make it possible to write components in other languages, such as TypeScript or SCSS, `Svelte` provides the [preprocess API](https://svelte.dev/docs#compile-time-svelte-preprocess), which allows to easily transform the content of your `markup` and your `style`/`script` tags. Writing your own preprocessor for, i.e SCSS is easy enough, but it can be cumbersome to have to always configure multiple preprocessors for the languages you'll be using. `svelte-preprocess` is a custom svelte preprocessor that acts as a facilitator to use other languages with Svelte, providing multiple features, sensible defaults and a less noisy development experience. It is recommended to use with `svelte.config.js` file, located at the project root. For other usage, please refer to [usage documentation](#usage-documentation). ```js import { sveltePreprocess } from 'svelte-preprocess'; const config = { preprocess: sveltePreprocess({ ... }) } export default config; ``` ## When to use it? Historically, `svelte-preprocess` was the go-to option whenever you had a language other than JS/HTML/CSS used inside your Svelte files. Today, depending on your setup, you may no longer need it: - If you're using Svelte 5 and are only using type features of TypeScript (i.e. things that just "go away" after transpiling to JS), you don't need any preprocessor, Svelte handles this natively - If you're using Vite and are using TypeScript or common CSS preprocessors (PostCSS, SCSS, Less, ...), use the preprocessor that comes with vite-plugin-svelte instead If these cases don't apply to you, use `svelte-preprocess`. ## Features ### Template tag _Vue-like_ support for defining your markup between a specific tag. The default tag is `template` but it can be [customized](/docs/preprocessing.md#auto-preprocessing-options). ```html