Browse Source

Translate documents under docs/zh-Hans/AspNetCore

pull/550/head
maliming 8 years ago
parent
commit
cfa29ed00c
  1. 158
      docs/zh-Hans/AspNetCore/Bundling-Minification.md
  2. 86
      docs/zh-Hans/AspNetCore/Client-Side-Package-Management.md
  3. 2
      docs/zh-Hans/Index.md

158
docs/zh-Hans/AspNetCore/Bundling-Minification.md

@ -1,24 +1,25 @@
## ASP.NET Core MVC Bundling & Minification
## ASP.NET Core MVC 捆绑 & 压缩
There are many ways of bundling & minification of client side resources (JavaScript and CSS files). Most common ways are:
有许多方法可以捆绑&压缩客户端资源(JavaScript和CSS文件). 最常见的方式是:
* Using the [Bundler & Minifier](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BundlerMinifier) Visual Studio extension or the [NuGet package](https://www.nuget.org/packages/BuildBundlerMinifier/).
* Using [Gulp](https://gulpjs.com/)/[Grunt](https://gruntjs.com/) task managers and their plugins.
* 使用Visual Studio[捆绑&压缩](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BundlerMinifier)扩展或者其它的[NuGet相关包](https://www.nuget.org/packages/BuildBundlerMinifier/).
ABP offers a simple, dynamic, powerful, modular and built-in way.
* 使用[Gulp](https://gulpjs.com/)/[Grunt](https://gruntjs.com/)及其插件.
### Volo.Abp.AspNetCore.Mvc.UI.Bundling Package
ABP内置了简单,动态,强大,模块化的方式.
> This package is already installed by default with the startup templates. So, most of the time, you don't need to install it manually.
### Volo.Abp.AspNetCore.Mvc.UI.Bundling 包
Install the `Volo.Abp.AspNetCore.Mvc.UI.Bundling` nuget package to your project:
> 默认情况下已在启动模板安装此软件包. 大多数情况下,你不需要手动安装它.
将`Volo.Abp.AspNetCore.Mvc.UI.Bundling` nuget包安装到您的项目中:
````
install-package Volo.Abp.AspNetCore.Mvc.UI.Bundling
````
Then you can add the `AbpAspNetCoreMvcUiBundlingModule` dependency to your module:
然后将`AbpAspNetCoreMvcUiBundlingModule`依赖项添加到你的模块上:
````C#
using Volo.Abp.Modularity;
@ -36,7 +37,7 @@ namespace MyCompany.MyProject
### Razor Bundling Tag Helpers
The simplest way of creating a bundle is to use `abp-script-bundle` or `abp-style-bundle` tag helpers. Example:
创建bundle的最简单方法是使用`abp-script-bundle`或`abp-style-bundle` tag helpers. 例如:
````html
<abp-style-bundle name="MyGlobalBundle">
@ -47,26 +48,26 @@ The simplest way of creating a bundle is to use `abp-script-bundle` or `abp-styl
</abp-style-bundle>
````
This bundle defines a style bundle with a **unique name**: `MyGlobalBundle`. It's very easy to understand how to use it. Let's see how it *works*:
`abp-script-bundle`定义了一个带有**唯一名称**的样式包:`MyGlobalBundle`. 使用方法很容易理解. 让我们看看它是如何*工作的*:
* ABP creates the bundle as **lazy** from the provided files when it's **first requested**. For the subsequent calls, it's returned from the **cache**. That means if you conditionally add the files to the bundle, it's executed only once and any changes of the condition will not effect the bundle for the next requests.
* ABP adds bundle files **individually** to the page for the `development` environment. It automatically bundles & minifies for other environments (`staging`, `production`...).
* The bundle files may be **physical** files or [**virtual/embedded** files](../Virtual-File-System.md).
* ABP automatically adds **version query string** to the bundle file URL to prevent browsers from caching when the bundle is being updated. (like ?_v=67872834243042 - generated from last change date of the related files). The versioning works even if the bundle files are individually added to the page (on the development environment).
* 当首次请求时,ABP从提供的文件中 **(延迟)lazy** 创建. 后续将从 **缓存** 中返回内容. 这意味着如果你有条件地将文件添加到包中,它只执行一次, 并且条件的任何更改都不会影响下一个请求的包.
* 在`development`环境中ABP会将包文件**单独**添加到页面中, 其他环境(`staging`,`production`...)会自动捆绑和压缩.
* 捆绑文件可以是**物理**文件或[**虚拟/嵌入**](../Virtual-File-System.md)的文件.
* ABP自动将 **版本查询字符串(version query string)** 添加到捆绑文件的URL中,以防止浏览器缓存. 如:?_v=67872834243042(从文件的上次更改日期生成). 即使捆绑文件单独添加到页面(在`development`环境中), 版本控制仍然有效.
#### Importing The Bundling Tag Helpers
#### 导入 Bundling Tag Helpers
> This is already imported by default with the startup templates. So, most of the time, you don't need to add it manually.
> 默认情况下已在启动模板导入. 大多数情况下,你不需要手动安装它.
In order to use bundle tag helpers, you need to add it into your `_ViewImports.cshtml` file or into your page:
要使用`bundle tag helpers`, 你需要将其添加到`_ViewImports.cshtml`文件或页面中:
````
@addTagHelper *, Volo.Abp.AspNetCore.Mvc.UI.Bundling
````
#### Unnamed Bundles
#### 未命名的 Bundles
The `name` is **optional** for the razor bundle tag helpers. If you don't define a name, it's automatically **calculated** based on the used bundle file names (they are **concatenated** and **hashed**). Example:
对于razor bundle tag helpers, `name`是**可选**. 如果没有定义一个名字,它将根据使用的捆绑文件名自动**计算生成**(they are **concatenated** and **hashed**) 例:
````html
<abp-style-bundle>
@ -80,33 +81,36 @@ The `name` is **optional** for the razor bundle tag helpers. If you don't define
</abp-style-bundle>
````
This will potentially create **two different bundles** (one incudes the `my-global-style.css` and other does not).
这将潜在地创建**两个不同的bundles**(一个包括`my-global-style.css`而另一个则不包括).
Advantages of **unnamed** bundles:
**未命名的** bundles优点:
* Can **conditionally add items** to the bundle. But this may lead to multiple variations of the bundle based on the conditions.
* 可以**有条件地将项目**添加到捆绑包中. 但这可能会导致基于条件的捆绑的存在多种变化.
Advantages of **named** bundles:
**命名** bundles优点:
* Other **modules can contribute** to the bundle by its name (see the sections below).
* 其他模块可以通过其名称为捆绑包做出贡献(参见下面的部分).
#### Single File
#### 单个文件
If you need to just add a single file to the page, you can use the `abp-script` or `abp-style` tag without a wrapping in the `abp-script-bundle` or `abp-style-bundle` tag. Example:
如果你只需要在页面中添加一个文件, 你可以使用`abp-script`或`abp-style`而不需要包含在`abp-script-bundle`或`abp-style-bundle`中. 例:
````xml
<abp-script src="/scripts/my-script.js" />
````
The bundle name will be *scripts.my-scripts* for the example above ("/" is replaced by "."). All bundling features are work as expected for single file bundles too.
对于上面的示例,包名称将是 *scripts.my-scripts*("/"替换为"."). 所有捆绑功能也可以按预期应用于单个文件.
### Bundling Options
### Bundling 选项
If you need to use same bundle in **multiple pages** or want to use some more **powerful features**, you can configure bundles **by code** in your [module](../Module-Development-Basics.md) class.
#### Creating A New Bundle
如果你需要在 **多个页面中使用相同的包** 或想要使用更多 **强大功能**, 你可以在[模块](../Module-Development-Basics.md)类中进行**配置**.
#### 创建一个新的捆绑包
Example usage:
用法示例:
````C#
[DependsOn(typeof(AbpAspNetCoreMvcUiBundlingModule))]
@ -131,20 +135,20 @@ public class MyWebModule : AbpModule
}
````
> You can use the same name (*MyGlobalBundle* here) for a script & style bundle since they are added to different collections (`ScriptBundles` and `StyleBundles`).
> 您可以在脚本和样式包中使用相同的名称(*MyGlobalBundle*), 因为它们被添加到不同的集合(`ScriptBundles`和`StyleBundles`).
After defining such a bundle, it can be included into a page using the same tag helpers defined above. Example:
在定义bundle之后, 可以使用上面定义的相同tag helpers将其包括在页面中. 例如:
````html
<abp-script-bundle name="MyGlobalBundle" />
````
This time, no file defined in the tag helper definition because the bundle files are defined by the code.
这次tag helper定义中没有定义文件, 因为捆绑文件是由代码定义的.
#### Configuring An Existing Bundle
#### 配置现有的 Bundle
ABP supports [modularity](../Module-Development-Basics.md) for bundling as well. A module can modify an existing bundle that is created by a dependant module.
Example:
ABP也支持[模块化](../Module-Development-Basics.md)捆绑. 模块可以修改由依赖模块创建的捆绑包.
例如:
````C#
[DependsOn(typeof(MyWebModule))]
@ -166,13 +170,13 @@ public class MyWebExtensionModule : AbpModule
}
````
> It's not possible to configure unnamed bundle tag helpers by code, because their name are not known at the development time. It's suggested to always use a name for a bundle tag helper.
> 无法通过代码配置未命名的bundle tag helpers, 因为它们的名称在开发时是未知的. 建议始终使用bundle tag helper的名称.
### Bundle Contributors
### Bundle 贡献者
Adding files to an existing bundle seems useful. What if you need to **replace** a file in the bundle or you want to **conditionally** add files? Defining a bundle contributor provides extra power for such cases.
将文件添加到现有bundle似乎很有用. 如果你需要**替换**bundle中的文件或者你想**有条件地**添加文件怎么办? 定义bundle贡献者可为此类情况提供额外的功能.
An example bundle contributor that replaces bootstrap.css with a customized version:
一个bundle的贡献者使用自定义版本bootstrap.css替换示例:
````C#
public class MyExtensionGlobalStyleContributor : BundleContributor
@ -187,7 +191,7 @@ public class MyExtensionGlobalStyleContributor : BundleContributor
}
````
Then you can use this contributor as below:
然后你可以按照下面的代码使用这个贡献者:
````C#
services.Configure<BundlingOptions>(options =>
@ -200,8 +204,8 @@ services.Configure<BundlingOptions>(options =>
});
````
Contributors can also be used in the bundle tag helpers.
Example:
贡献者也可以在bundle tag helpers中使用.
例如:
````xml
<abp-style-bundle>
@ -211,12 +215,12 @@ Example:
</abp-style-bundle>
````
`abp-style` and `abp-script` tags can get `type` attributes (instead of `src` attributes) as shown in this sample. When you add a bundle contributor, its dependencies are also automatically added to the bundle.
`abp-style`和`abp-script`标签可以使用`type`属性(而不是`src`属性), 如本示例所示. 添加bundle贡献者时, 其依赖关系也会自动添加到bundle中.
#### Contributor Dependencies
A bundle contributor can have one or more dependencies to other contributors.
Example:
bundle贡献者可以与其他贡献者具有一个或多个依赖关系.
例如:
````C#
[DependsOn(typeof(MyDependedBundleContributor))] //Define the dependency
@ -226,19 +230,19 @@ public class MyExtensionStyleBundleContributor : BundleContributor
}
````
When a bundle contributor is added, its dependencies are **automatically and recursively** added. Dependencies added by the **dependency order** by preventing **duplicates**. Duplicates are prevented even if they are in separated bundles. ABP organizes all bundles in a page and eliminates duplications.
添加bundle贡献者时,其依赖关系将 **自动并递归** 添加. **依赖顺序** 通过阻止 **重复** 添加的依赖关系. 即使它们处于分离的束中,也会阻止重复. ABP在页面中组织所有bundle并消除重复.
Creating contributors and defining dependencies is a way of organizing bundle creation across different modules.
创建贡献者和定义依赖关系是一种跨不同模块组织包创建的方法.
#### Accessing to the IServiceProvider
#### 访问 IServiceProvider
While it is rarely needed, `BundleConfigurationContext` has a `ServiceProvider` property that you can resolve service dependencies inside the `ConfigureBundle` method.
虽然很少需要它, 但是`BundleConfigurationContext`有一个`ServiceProvider`属性, 你可以在`ConfigureBundle`方法中解析服务依赖.
#### Standard Package Contributors
#### 标准包装贡献者
Adding a specific NPM package resource (js, css files) into a bundle is pretty straight forward for that package. For example you always add the `bootstrap.css` file for the bootstrap NPM package.
将特定的NPM包资源(js,css文件)添加到包中对于该包非常简单. 例如, 你总是为bootstrap NPM包添加`bootstrap.css`文件.
There are built-in contributors for all [standard NPM packages](Client-Side-Package-Management.md). For example, if your contributor depends on the bootstrap, you can just declare it, instead of adding the bootstrap.css yourself.
所有[标准NPM包](Client-Side-Package-Management.md)都有内置的贡献者. 例如,如果你的贡献者依赖于引导程序,你可以声明它,而不是自己添加bootstrap.css.
````C#
[DependsOn(typeof(BootstrapStyleContributor))] //Define the bootstrap style dependency
@ -248,25 +252,25 @@ public class MyExtensionStyleBundleContributor : BundleContributor
}
````
Using the built-in contributors for standard packages;
使用标准包的内置贡献者:
* Prevents you typing **invalid the resource paths**.
* Prevents changing your contributor if the resource **path changes** (the dependant contributor will handle it).
* Prevents multiple modules adding the **duplicate the files**.
* Manages **dependencies recursively** (adds dependencies of dependencies, if necessary).
* 防止你输入**无效的资源路径**.
* 如果资源 **路径发生变化** (依赖贡献者将处理它),则防止更改你的贡献者.
* 防止多个模块添加**重复文件**.
* 以递归方式管理依赖项(如果需要,添加依赖项的依赖项).
##### Volo.Abp.AspNetCore.Mvc.UI.Packages Package
##### Volo.Abp.AspNetCore.Mvc.UI.Packages
> This package is already installed by default in the startup templates. So, most of the time, you don't need to install it manually.
> 默认情况下已在启动模板安装此软件包. 大多数情况下,你不需要手动安装它.
Standard package contributors are defined in the `Volo.Abp.AspNetCore.Mvc.UI.Packages` NuGet package.
To install it to your project:
标准包贡献者在`Volo.Abp.AspNetCore.Mvc.UI.Packages` NuGet包中定义.
安装到你的项目中:
````
install-package Volo.Abp.AspNetCore.Mvc.UI.Packages
````
Then add the `AbpAspNetCoreMvcUiPackagesModule` module dependency to your own module;
然后将`AbpAspNetCoreMvcUiPackagesModule`模块依赖项添加到你的模块中;
````C#
using Volo.Abp.Modularity;
@ -284,8 +288,8 @@ namespace MyCompany.MyProject
#### Bundle Inheritance
In some specific cases, it may be needed to create a **new** bundle **inherited** from other bundle(s). Inheriting from a bundle (recursively) inherits all files/contributors of that bundle. Then the derived bundle can add or modify files/contributors **without modifying** the original bundle.
Example:
在某些特定情况下, 可能需要从其他bundle创建一个 **新** bundle **继承**, 从bundle继承(递归)继承该bundle的所有文件/贡献者. 然后派生的bundle可以添加或修改文件/贡献者**而无需修改**原始包.
例如:
````c#
services.Configure<BundlingOptions>(options =>
@ -302,22 +306,22 @@ services.Configure<BundlingOptions>(options =>
});
````
### Themes
### 主题
Themes uses the standard package contributors to add library resources to page layouts. Themes may also define some standard/global bundles, so any module can contribute to these standard/global bundles. See the [theming documentation](Theming.md) for more.
主题使用标准包贡献者将库资源添加到页面布局. 主题还可以定义一些标准/全局包, 因此任何模块都可以为这些标准/全局包做出贡献. 有关更多信息, 请参阅[主题文档](Theming.md).
### Best Practices & Suggestions
### 最佳实践 & 建议
It's suggested to define multiple bundles for an application, each one is used for different purposes.
建议为应用程序定义多个包, 每个包用于不同的目的.
* **Global bundle**: Global style/script bundles are included to every page in the application. Themes already defines global style & script bundles. Your module can contribute to them.
* **Layout bundles**: This is a specific bundle to an individual layout. Only contains resources shared among all the pages use the layout. Use the bundling tag helpers to create the bundle as a good practice.
* **Module bundles**: For shared resources among the pages of an individual module.
* **Page bundles**: Specific bundles created for each page. Use the bundling tag helpers to create the bundle as a best practice.
* **全局包**: 应用程序中的每个页面都包含全局样式/脚本包. 主题已经定义了全局样式和脚本包. 您的模块可以为他们做出贡献.
* **布局包**: 这是针对单个布局的特定包. 仅包含在所有页面之间共享的资源使用布局. 使用bundling tag helpers创建捆绑包是一种很好的做法.
* **模块包**: 用于单个模块页面之间的共享资源.
* **页面包**: 为每个页面创建的特定包. 使用bundling tag helpers创建捆绑包作为最佳实践.
Establish a balance between performance, network bandwidth usage and count of many bundles.
在性能,网络带宽使用和捆绑包的数量之间建立平衡.
### See Also
### 参见
* [Client Side Package Management](Client-Side-Package-Management.md)
* [Theming](Theming.md)
* [客户端包管理](Client-Side-Package-Management.md)
* [主题](Theming.md)

86
docs/zh-Hans/AspNetCore/Client-Side-Package-Management.md

@ -1,73 +1,73 @@
## ASP.NET Core MVC Client Side Package Management
## ASP.NET Core MVC 客户端包管理
ABP framework can work with any type of client side package management systems. You can even decide to use no package management system and manage your dependencies manually.
ABP框架可以与任何类型的客户端包管理系统一起使用. 甚至你可以决定不使用包管理系统并手动管理依赖项.
However, ABP framework works best with **NPM/Yarn**. By default, built-in modules are configured to work with NPM/Yarn.
但是, ABP框架最适用于**NPM/Yarn**. 默认情况下,内置模块配置为与NPM/Yarn一起使用.
Finally, we suggest the [**Yarn**](https://yarnpkg.com/) over the NPM since it's faster, stable and also compatible with the NPM.
最后, 我们建议[**Yarn**](https://yarnpkg.com/)而不是NPM,因为它更快,更稳定并且与NPM兼容.
### @ABP NPM Packages
ABP is a modular platform. Every developer can create modules and the modules should work together in a **compatible** and **stable** state.
ABP是一个模块化平台. 每个开发人员都可以创建模块, 模块应该在**兼容**和**稳定**状态下协同工作.
One challenge is the **versions of the dependant NPM packages**. What if two different modules use the same JavaScript library but its different (and potentially incompatible) versions.
一个挑战是依赖NPM包的**版本**. 如果两个不同的模块使用相同的JavaScript库但其不同(并且可能不兼容)的版本会怎样.
To solve the versioning problem, we created a **standard set of packages** those depends on some common third-party libraries. Some example packages are [@abp/jquery](https://www.npmjs.com/package/@abp/jquery), [@abp/bootstrap](https://www.npmjs.com/package/@abp/bootstrap) and [@abp/font-awesome](https://www.npmjs.com/package/@abp/font-awesome). You can see the **list of packages** from the [Github repository](https://github.com/volosoft/abp/tree/master/npm/packs).
为了解决版本问题, 我们创建了一套**标准包**, 这取决于一些常见的第三方库. 一些示例包是[@abp/jquery](https://www.npmjs.com/package/@abp/jquery), [@ abp/bootstrap](https://www.npmjs.com/package/@abp/bootstrap)和[@abp/font-awesome](https://www.npmjs.com/package/@abp/font-awesome). 你可以从[Github存储库](https://github.com/volosoft/abp/tree/master/npm/packs)中查看**列表**.
The benefit of a **standard package** is:
**标准包**的好处是:
* It depends on a **standard version** of a package. Depending on this package is **safe** because all modules depend on the same version.
* It contains the gulp task to copy library resources (js, css, img... files) from the **node_modules** folder to **wwwroot/libs** folder. See the *Mapping The Library Resources* section for more.
Depending on a standard package is easy. Just add it to your **package.json** file like you normally do. Example:
* 它取决于包装的**标准版本**。 取决于此包是**安全**,因为所有模块都依赖于相同的版本。
* 它包含将库资源(js,css,img...文件)从**node_modules**文件夹复制到**wwwroot/libs**文件夹的gulp任务. 有关更多信息, 请参阅 *映射库资源* 部分.
依赖标准包装很容易. 只需像往常一样将它添加到**package.json**文件中. 例如:
````
{
...
"dependencies": {
"@abp/bootstrap": "^1.0.0"
}
}
````
建议依赖于标准软件包, 而不是直接依赖于第三方软件包.
It's suggested to depend on a standard package instead of directly depending on a third-party package.
#### Package Installation
#### 安装包
After depending on a NPM package, all you should do is to run the **yarn** command from the command line to install all the packages and their dependencies:
依赖于NPM包后, 你应该做的就是从命令行运行**yarn**命令来安装所有包及其依赖项:
````
yarn
````
Alternatively, you can use `npm install` but [Yarn](https://yarnpkg.com/) is suggested as mentioned before.
虽然你可以使用`npm install`,但如前所述,建议使用[Yarn](https://yarnpkg.com/).
#### Package Contribution
#### 贡献包
If you need a third-party NPM package that is not in the standard set of packages, you can create a Pull Request on the Github [repository](https://github.com/volosoft/abp). A pull request that follows these rules is accepted:
如果你需要不在标准软件包中的第三方NPM软件包,您可以在Github[repository](https://github.com/volosoft/abp)上创建Pull请求. 接受遵循这些规则的拉取请求:
* Package name should be named as `@abp/package-name` for a `package-name` on NPM (example: `@abp/bootstrap` for the `bootstrap` package).
* It should be the **latest stable** version of the package.
* It should only depend a **single** third-party package. It can depend on multiple `@abp/*` packages.
* The package should include a `abp.resourcemapping.js` file formatted as defined in the *Mapping The Library Resources* section. This file should only map resources for the depended package.
* You also need to create [bundle contributor(s)](Bundling-Minification.md) for the package you have created.
* 对于NPM上的`package-name`, 包名称应该命名为`@abp/package-name`(例如:`bootstrap`包的`@abp/bootstrap`).
* 它应该是**最新的稳定**版本的包.
* 它应该只依赖于**单个**第三方包. 它可以依赖于多个`@abp/*`包.
* 包应包含一个`abp.resourcemapping.js`文件格式,如*映射库资源*部分中所定义. 此文件应仅映射所依赖包的资源.
* 你还需要为你创建的包创建[bundle贡献者](Bundling-Minification.md).
See current standard packages for examples.
有关示例, 请参阅当前标准包.
### Mapping The Library Resources
### 映射库资源
Using NPM packages and NPM/Yarn tool is the de facto standard for client side libraries. NPM/Yarn tool creates a **node_modules** folder in the root folder of your web project.
使用NPM包和NPM/Yarn工具是客户端库的事实标准. NPM/Yarn工具在Web项目的根文件夹中创建一个**node_modules**文件夹.
Next challenge is copying needed resources (js, css, img... files) from the `node_modules` into a folder inside the **wwwroot** folder to make it accessible to the clients/browsers.
下一个挑战是将所需的资源(js,css,img ...文件)从`node_modules`复制到**wwwroot**文件夹内的文件夹中,以使其可供客户端/浏览器访问.
ABP defines a [Gulp](https://gulpjs.com/) based task to **copy resources** from **node_modules** to **wwwroot/libs** folder. Each **standard package** (see the *@ABP NPM Packages* section) defines the mapping for its own files. So, most of the time, you only configure dependencies.
ABP将基于[Gulp](https://gulpjs.com/)的任务定义为**将资源**从**node_modules**复制到**wwwroot/libs**文件夹. 每个**标准包**(参见*@ABP NPM Packages*部分)定义了自己文件的映射. 因此, 大多数情况你只配置依赖项.
The **startup templates** are already configured to work all these out of the box. This section will explain the configuration options.
**启动模板**已经配置为开箱即用的所有这些。 本节将介绍配置选项。
#### Resource Mapping Definition File
#### 资源映射定义文件
A module should define a JavaScript file named `abp.resourcemapping.js` which is formatted as in the example below:
模块应该定义一个名为`abp.resourcemapping.js`的JavaScript文件,其格式如下例所示:
````js
module.exports = {
@ -84,11 +84,11 @@ module.exports = {
}
````
* **aliases** section defines standard aliases (placeholders) that can be used in the mapping paths. **@node_modules** and **@libs** are required (by the standard packages), you can define your own aliases to reduce duplication.
* **clean** section is a list of folders to clean before copying the files.
* **mappings** section is a list of mappings of files/folders to copy. This example does not copy any resource itself, but depends on a standard package.
* **aliases**部分定义了可在映射路径中使用的标准别名(占位符). **@node_modules**和 **@libs**是必需的(通过标准包), 你可以定义自己的别名以减少重复.
* **clean**部分是在复制文件之前要清理的文件夹列表.
* **mappings**部分是要复制的文件/文件夹的映射列表.此示例不会复制任何资源本身,但取决于标准包.
An example mapping configuration is shown below:
示例映射配置如下所示:
````js
mappings: {
@ -97,19 +97,19 @@ mappings: {
}
````
#### Using The Gulp
#### 使用 Gulp
Once you properly configure the `abp.resourcemapping.js` file, you can run the gulp command from the command line:
正确配置`abp.resourcemapping.js`文件后, 可以从命令行运行gulp命令:
````
gulp
````
When you run the `gulp`, all packages will copy their own resources into the **wwwroot/libs** folder. Running `yarn & gulp` is only necessary if you make a change in your dependencies in the **package.json** file.
当你运行`gulp`时,所有包都会将自己的资源复制到**wwwroot/libs**文件夹中. 只有在**package.json**文件中对依赖项进行更改时, 才需要运行`yarn&gulp`.
> When you run the Gulp command, dependencies of the application are resolved using the package.json file. The Gulp task automatically discovers and maps all resources from all dependencies (recursively).
> 运行Gulp命令时, 使用package.json文件解析应用程序的依赖关系. Gulp任务自动发现并映射来自所有依赖项的所有资源(递归).
#### See Also
#### 参见
* [Bundling & Minification](Bundling-Minification.md)
* [Theming](Theming.md)
* [捆绑 & 压缩](Bundling-Minification.md)
* [主题](Theming.md)

2
docs/zh-Hans/Index.md

@ -57,7 +57,7 @@
* [客户端包管理](AspNetCore/Client-Side-Package-Management.md)
* [捆绑&压缩](AspNetCore/Bundling-Minification.md)
* [Tag Helpers](Tag-Helpers.md)
* [主题](AspNetCore/Theming.md)
* [主题](AspNetCore/Theming.md)
* 数据访问
* [Entity Framework Core 集成](Entity-Framework-Core.md)
* [MongoDB 集成](MongoDB.md)

Loading…
Cancel
Save