Skip to content

Commit

Permalink
docs: avoid horizontal scrollbars (#12133)
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev authored Feb 21, 2023
1 parent 73c3999 commit ede8bac
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
5 changes: 3 additions & 2 deletions docs/guide/api-hmr.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ if (import.meta.hot) {
import.meta.hot.accept(
['./foo.js', './bar.js'],
([newFooModule, newBarModule]) => {
// The callback receives an array where only the updated module is non null
// If the update was not successful (syntax error for ex.), the array is empty
// The callback receives an array where only the updated module is
// non null. If the update was not successful (syntax error for ex.),
// the array is empty
},
)
}
Expand Down
7 changes: 5 additions & 2 deletions docs/guide/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ The automatic injection of CSS contents can be turned off via the `?inline` quer

```js
import styles from './foo.css' // will be injected into the page
import otherStyles from './bar.css?inline' // will not be injected into the page
import otherStyles from './bar.css?inline' // will not be injected
```

## Static Assets
Expand Down Expand Up @@ -404,7 +404,10 @@ const modules = {
When combined with `eager` it's even possible to have tree-shaking enabled for those modules.

```ts
const modules = import.meta.glob('./dir/*.js', { import: 'setup', eager: true })
const modules = import.meta.glob('./dir/*.js', {
import: 'setup',
eager: true,
})
```

```ts
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ cd vite
pnpm install
cd packages/vite
pnpm run build
pnpm link --global # you can use your preferred package manager for this step
pnpm link --global # use your preferred package manager for this step
```

Then go to your Vite based project and run `pnpm link --global vite` (or the package manager that you used to link `vite` globally). Now restart the development server to ride on the bleeding edge!
Expand Down
22 changes: 11 additions & 11 deletions docs/guide/ssr.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ async function createServer() {
appType: 'custom'
})

// use vite's connect instance as middleware
// if you use your own express router (express.Router()), you should use router.use
// Use vite's connect instance as middleware. If you use your own
// express router (express.Router()), you should use router.use
app.use(vite.middlewares)

app.use('*', async (req, res) => {
Expand Down Expand Up @@ -110,18 +110,18 @@ app.use('*', async (req, res, next) => {
'utf-8',
)

// 2. Apply Vite HTML transforms. This injects the Vite HMR client, and
// also applies HTML transforms from Vite plugins, e.g. global preambles
// from @vitejs/plugin-react
// 2. Apply Vite HTML transforms. This injects the Vite HMR client,
// and also applies HTML transforms from Vite plugins, e.g. global
// preambles from @vitejs/plugin-react
template = await vite.transformIndexHtml(url, template)

// 3. Load the server entry. vite.ssrLoadModule automatically transforms
// your ESM source code to be usable in Node.js! There is no bundling
// 3. Load the server entry. ssrLoadModule automatically transforms
// ESM source code to be usable in Node.js! There is no bundling
// required, and provides efficient invalidation similar to HMR.
const { render } = await vite.ssrLoadModule('/src/entry-server.js')

// 4. render the app HTML. This assumes entry-server.js's exported `render`
// function calls appropriate framework SSR APIs,
// 4. render the app HTML. This assumes entry-server.js's exported
// `render` function calls appropriate framework SSR APIs,
// e.g. ReactDOMServer.renderToString()
const appHtml = await render(url)

Expand All @@ -131,8 +131,8 @@ app.use('*', async (req, res, next) => {
// 6. Send the rendered HTML back.
res.status(200).set({ 'Content-Type': 'text/html' }).end(html)
} catch (e) {
// If an error is caught, let Vite fix the stack trace so it maps back to
// your actual source code.
// If an error is caught, let Vite fix the stack trace so it maps back
// to your actual source code.
vite.ssrFixStacktrace(e)
next(e)
}
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/static-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Now the `preview` command will launch the server at `http://localhost:8080`.
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
Expand Down

0 comments on commit ede8bac

Please sign in to comment.