Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Локализация docs/1.getting-started/4.assets.md (#28) #156

Merged
merged 2 commits into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions docs/1.getting-started/4.assets.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,58 @@
---
title: 'Assets'
description: 'Nuxt offers two options for your assets.'
title: 'Ассеты'
description: 'Nuxt предлагает два варианта для ваших ассетов.'
navigation.icon: i-ph-image-duotone
---

Nuxt uses two directories to handle assets like stylesheets, fonts or images.
Nuxt использует две директории для обработки таких ассетов, как: таблицы стилей, шрифты и изображения.

- The [`public/`](/docs/guide/directory-structure/public) directory content is served at the server root as-is.
- The [`assets/`](/docs/guide/directory-structure/assets) directory contains by convention every asset that you want the build tool (Vite or webpack) to process.
- Директория [`public/`](/docs/guide/directory-structure/public) содержит контент, который предоставляется в корне сервера "как есть".
- Директория [`assets/`](/docs/guide/directory-structure/assets) содержит по умолчанию все ассеты, которые должен обрабатывать сборщик (Vite или webpack).

## Public Directory
## Директория Public

The [`public/`](/docs/guide/directory-structure/public) directory is used as a public server for static assets publicly available at a defined URL of your application.
Директория [`public/`](/docs/guide/directory-structure/public) используется как публичный сервер для статических ресурсов, доступных по определенному URL-адресу приложения.

You can get a file in the [`public/`](/docs/guide/directory-structure/public) directory from your application's code or from a browser by the root URL `/`.
Вы можете получить файл в директории [`public/`](/docs/guide/directory-structure/public) из кода приложения или из браузера по корневому URL `/`.

### Пример

For example, referencing an image file in the `public/img/` directory, available at the static URL `/img/nuxt.png`:
Например, ссылка на файл изображения из директории `public/img/`, доступна по статическому URL `/img/nuxt.png`:

```vue [app.vue]
<template>
<img src="/img/nuxt.png" alt="Discover Nuxt 3" />
<img src="/img/nuxt.png" alt="Откройте для себя Nuxt 3" />
</template>
```

## Assets Directory
## Директория Assets

Nuxt uses [Vite](https://vitejs.dev/guide/assets.html) (default) or [webpack](https://webpack.js.org/guides/asset-management) to build and bundle your application. The main function of these build tools is to process JavaScript files, but they can be extended through [plugins](https://vitejs.dev/plugins) (for Vite) or [loaders](https://webpack.js.org/loaders) (for webpack) to process other kind of assets, like stylesheets, fonts or SVG. This step transforms the original file mainly for performance or caching purposes (such as stylesheets minification or browser cache invalidation).
Nuxt использует [Vite](https://vitejs.dev/guide/assets.html) (по умолчанию) или [webpack](https://webpack.js.org/guides/asset-management) для сборки и упаковки приложения. Основная функция этих инструментов сборки - обработка файлов JavaScript, но они могут быть расширены с помощью [плагинов](https://vitejs.dev/plugins) (для Vite) или [загрузчиков](https://webpack.js.org/loaders) (для webpack) для обработки других видов ресурсов, таких как таблицы стилей, шрифты или SVG. На этом этапе исходный файл преобразуется (в основном) для повышения производительности или кэширования (например, для минимизации таблиц стилей или инвалидации кэша браузера).

By convention, Nuxt uses the [`assets/`](/docs/guide/directory-structure/assets) directory to store these files but there is no auto-scan functionality for this directory, and you can use any other name for it.
По соглашению, Nuxt использует директорию [`assets/`](/docs/guide/directory-structure/assets) для хранения этих файлов, но для этого каталога нет функции автоматического сканирования, и вы можете использовать для него любое другое имя.

In your application's code, you can reference a file located in the [`assets/`](/docs/guide/directory-structure/assets) directory by using the `~/assets/` path.
В коде приложения вы можете ссылаться на файл, расположенный в директории [`assets/`](/docs/guide/directory-structure/assets) используя путь `~/assets/`.

### Пример

For example, referencing an image file that will be processed if a build tool is configured to handle this file extension:
Например, ссылка на файл изображения, который будет обработан, если инструмент сборки настроен на обработку файла с таким расширением:

```vue [app.vue]
<template>
<img src="~/assets/img/nuxt.png" alt="Discover Nuxt 3" />
<img src="~/assets/img/nuxt.png" alt="Откройте для себя Nuxt 3" />
</template>
```

::note
Nuxt won't serve files in the [`assets/`](/docs/guide/directory-structure/assets) directory at a static URL like `/assets/my-file.png`. If you need a static URL, use the [`public/`](#public-directory) directory.
::
Nuxt не будет предоставлять файлы в директории [`assets/`](/docs/guide/directory-structure/assets) по статическому URL наподобие `/assets/my-file.png`. Если вам нужен статический URL, используйте директорию [`public/`](#public-directory).::

### Global Styles Imports
### Глобальные импорты стилей

To globally insert statements in your Nuxt components styles, you can use the [`Vite`](/docs/api/nuxt-config#vite) option at your [`nuxt.config`](/docs/api/nuxt-config) file.
Чтобы глобально добавлять выражения в стили компонентов Nuxt, вы можете использовать опцию [`Vite`](/docs/api/nuxt-config#vite) в файле [`nuxt.config`](/docs/api/nuxt-config).

#### Пример

In this example, there is a [sass partial](https://sass-lang.com/documentation/at-rules/use#partials) file containing color variables to be used by your Nuxt [pages](/docs/guide/directory-structure/pages) and [components](/docs/guide/directory-structure/components)
В этом примере, есть файл [sass partial](https://sass-lang.com/documentation/at-rules/use#partials), содержащий переменные с цветами, которые будут использованы [страницами](/docs/guide/directory-structure/pages) и [компонентами](/docs/guide/directory-structure/components) Nuxt.

::code-group

Expand All @@ -69,7 +68,7 @@ $secondary: #E4A79D

::

In your `nuxt.config`
В файле `nuxt.config`

::code-group

Expand Down