Skip to content

Commit fae6ad8

Browse files
committed
docs: ✏️ correct casing for language names
1 parent 27a2ecf commit fae6ad8

File tree

4 files changed

+275
-241
lines changed

4 files changed

+275
-241
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Svelte Preprocess
22

3-
> A [Svelte](https://svelte.dev) preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, Coffeescript, TypeScript, Pug and much more.
3+
> A [Svelte](https://svelte.dev) preprocessor with sensible defaults and support for: PostCSS, SCSS, Less, Stylus, CoffeeScript, TypeScript, Pug and much more.
44
55
<p>
66
<a href="https://www.npmjs.com/package/svelte-preprocess">
@@ -25,26 +25,26 @@
2525
- [Template tag](#template-tag)
2626
- [External files](#external-files)
2727
- [Global style](#global-style)
28-
- [Modern Javascript syntax](#modern-javascript-syntax)
28+
- [Modern JavaScript syntax](#modern-javascript-syntax)
2929
- [Replace values](#replace-values)
3030
- [Built-in support for commonly used languages](#built-in-support-for-commonly-used-languages)
3131

3232
## What is it?
3333

34-
`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#svelte_preprocess), which allows to easily transform the content of your `markup` and your `style`/`script` tags.
34+
`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#svelte_preprocess), which allows to easily transform the content of your `markup` and your `style`/`script` tags.
3535

36-
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.
36+
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.
3737

3838
`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.
3939

4040
```js
4141
import svelte from 'rollup-plugin-svelte'
42-
import sveltePreprocess from 'svelte-preprocess'
42+
import autoPreprocess from 'svelte-preprocess'
4343

4444
export default {
4545
plugins: [
4646
svelte({
47-
preprocess: sveltePreprocess({ ... })
47+
preprocess: autoPreprocess({ ... })
4848
})
4949
]
5050
}
@@ -114,9 +114,9 @@ Works best with nesting-enabled CSS preprocessors, but regular CSS selectors lik
114114

115115
_**Note**: needs PostCSS to be installed._
116116

117-
### Modern Javascript syntax
117+
### Modern JavaScript syntax
118118

119-
`svelte-preprocess` allows you to run your component code through `babel` before sending it to the compiler, allowing you to use new language features such as optional operators and nullish coalescing. However, note that `babel` should transpile your component code to the javascript version supported by the Svelte compiler, so ES6+.
119+
`svelte-preprocess` allows you to run your component code through Babel before sending it to the compiler, allowing you to use new language features such as optional operators and nullish coalescing. However, note that Babel should transpile your component code to the javascript version supported by the Svelte compiler, so ES6+.
120120

121121
For example, with `@babel/preset-env` your config could be:
122122

@@ -153,7 +153,7 @@ Replace a set of string patterns in your components markup by passing an array o
153153
In example, to replace inject the value of `process.env.NODE_ENV`:
154154

155155
```js
156-
sveltePreprocess({
156+
autoPreprocess({
157157
replace: ['process.env.NODE_ENV', JSON.stringify(process.env.NODE_ENV)],
158158
});
159159
```
@@ -176,7 +176,7 @@ into
176176

177177
### Built-in support for commonly used languages
178178

179-
The current supported languages out-of-the-box are `SCSS`, `Stylus`, `Less`, `Coffeescript`, `TypeScript`, `Pug`, `PostCSS`, `Babel`.
179+
The current supported languages out-of-the-box are Sass, Stylus, Less, CoffeeScript, TypeScript, Pug, PostCSS, Babel.
180180

181181
```html
182182
<template lang="pug">

docs/getting-started.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ $ npm install -D svelte-preprocess
2626

2727
`svelte-preprocess` doesn't have any language specific dependency, so it's up to us to install the rest of tools we are going to use:
2828

29-
- `babel`: `npm install -D @babel/core @babel/preset-...`
30-
- `coffeescript`: `npm install -D coffeescript`
31-
- `typescript`: `npm install -D typescript`
32-
- `postcss`: `npm install -D postcss postcss-load-config`
33-
- `less`: `npm install -D less`
34-
- `sass`: `npm install -D node-sass` or `npm install -D sass`
35-
- `pug`: `npm install -D pug`
36-
- `stylus`: `npm install -D stylus`
29+
- Babel: `npm install -D @babel/core @babel/preset-...`
30+
- CoffeeScript: `npm install -D coffeescript`
31+
- TypeScript: `npm install -D typescript`
32+
- PostCSS: `npm install -D postcss postcss-load-config`
33+
- Less: `npm install -D less`
34+
- Sass: `npm install -D node-sass` or `npm install -D sass`
35+
- Pug: `npm install -D pug`
36+
- Stylus: `npm install -D stylus`
3737

3838
For now, let's just install the main library.
3939

@@ -70,21 +70,21 @@ export default {
7070
}
7171
```
7272

73-
Now our app's code can be written in any of the syntaxes supported by `svelte-preprocess`: `SCSS`, `Stylus`, `Less`, `Coffeescript`, `TypeScript`, `Pug`, `PostCSS`, `Babel`.
73+
Now our app's code can be written in any of the syntaxes supported by `svelte-preprocess`: Sass, Stylus, Less, CoffeeScript, TypeScript, Pug, PostCSS, Babel.
7474

7575
_**Note:** If you use VS Code, check [its usage guide](/docs/usage.md#with-svelte-vs-code) to make the Svelte VS Code extension understand the content of your components._
7676

7777
## 3. Configuring preprocessors
7878

79-
Now let's assume our app markup is going to be written in `pug`, our scripts in `Typescript`, and our styles in `SCSS`. We also want our styles to be auto-prefixed, so we're also going to need `postcss`. Let's install these dependencies:
79+
Now let's assume our app markup is going to be written in Pug, our scripts in TypeScript, and our styles in Sass. We also want our styles to be auto-prefixed, so we're also going to need PostCSS. Let's install these dependencies:
8080

81-
**Important:** `svelte-preprocess` only handles content passed to it by `svelte-loader`, `rollup-plugin-svelte` and similar tools. If our `typescript` component import a `typescript` file, the bundler will be the one responsible for handling it. We must make sure it knows how to handle it!
81+
**Important:** `svelte-preprocess` only handles content passed to it by `svelte-loader`, `rollup-plugin-svelte` and similar tools. If our TypeScript component import a TypeScript file, the bundler will be the one responsible for handling it. We must make sure it knows how to handle it!
8282

8383
```shell
8484
$ npm i -D typescript sass postcss autoprefixer pug @rollup/plugin-typescript
8585
```
8686

87-
After the installation is complete, we still need to configure our `postcss` options and add `@rollup/plugin-typescript` to our config.
87+
After the installation is complete, we still need to configure our PostCSS options and add `@rollup/plugin-typescript` to our config.
8888

8989
```diff
9090
import svelte from 'rollup-plugin-svelte'
@@ -143,7 +143,7 @@ And we're done! Our components can now be written as:
143143

144144
### 3.1. Setting default languages
145145

146-
Ok, we now can write our entire app with `pug`, `typescript` and `scss`, but typing `lang="..."` in every file can become an obnoxious process. In [auto-preprocessing mode](/docs/preprocessing.md#auto-preprocessing), `svelte-preprocess` [lets us define the default languages](/docs/preprocessing.md#auto-preprocessing-options) of our components. It's setted by default to `html`, `javascript` and `css`. Let's change that so we don't need those `lang` attributes.
146+
Ok, we now can write our entire app with Pug, TypeScript and SCSS, but typing `lang="..."` in every file can become an obnoxious process. In [auto-preprocessing mode](/docs/preprocessing.md#auto-preprocessing), `svelte-preprocess` [lets us define the default languages](/docs/preprocessing.md#auto-preprocessing-options) of our components. It's setted by default to HTML, JavaScript and CSS. Let's change that so we don't need those `lang` attributes.
147147

148148
_**Disclaimer**: The Svelte VS Code extension uses the `lang` or `type` attribute to correctly highlight your code. At the time of writing, the extension doesn't support default languages. Doing this can lead to errors on your IDE._
149149

@@ -202,18 +202,18 @@ Now our components are a bit leaner!
202202
</style>
203203
```
204204

205-
_**Note**: If the `<template>` tag is not found and the default language is not `html`, `svelte-preprocess` expects the whole markup to be written in that language. In example, for `pug`, this means the `script` and `style` tags must be written following pug's syntax._
205+
_**Note**: If the `<template>` tag is not found and the default language is not HTML, `svelte-preprocess` expects the whole markup to be written in that language. In example, for Pug, this means the `script` and `style` tags must be written following pug's syntax._
206206

207207
### 3.2 Prepending content
208208

209-
Now we're in need of a `scss` file to hold some variables. Let's assume it's created at `src/styles/variables.scss`.
209+
Now we're in need of a SCSS file to hold some variables. Let's assume it's created at `src/styles/variables.scss`.
210210

211211
```scss
212212
// src/styles/variables.scss
213213
$primary-color: red;
214214
```
215215

216-
As in any `scss` project, we could just `@use './path/to/variables.scss`, but that can also become boring. `svelte-preprocess` [accepts a `prependData`](/docs/preprocessing.md#preprocessors) for almost every processor. Let's use it to prepend our import!
216+
As in any SCSS project, we could just `@use './path/to/variables.scss`, but that can also become boring. `svelte-preprocess` [accepts a `prependData`](/docs/preprocessing.md#preprocessors) for almost every processor. Let's use it to prepend our import!
217217

218218
```diff
219219
+ import path from 'path'

0 commit comments

Comments
 (0)