Skip to content

Commit fd87cd8

Browse files
authored
Removed BundlerMinifier recommendations. (#17848)
1 parent bb339ea commit fd87cd8

1 file changed

Lines changed: 3 additions & 131 deletions

File tree

aspnetcore/client-side/bundling-and-minification.md

Lines changed: 3 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: scottaddie
44
description: Learn how to optimize static resources in an ASP.NET Core web application by applying bundling and minification techniques.
55
ms.author: scaddie
66
ms.custom: mvc
7-
ms.date: 06/17/2019
7+
ms.date: 04/15/2020
88
uid: client-side/bundling-and-minification
99
---
1010
# Bundle and minify static assets in ASP.NET Core
@@ -57,7 +57,7 @@ Browsers are fairly verbose with regard to HTTP request headers. The total bytes
5757

5858
## Choose a bundling and minification strategy
5959

60-
The MVC and Razor Pages project templates provide an out-of-the-box solution for bundling and minification consisting of a JSON configuration file. Third-party tools, such as the [Grunt](xref:client-side/using-grunt) task runner, accomplish the same tasks with a bit more complexity. A third-party tool is a great fit when your development workflow requires processing beyond bundling and minification—such as linting and image optimization. By using design-time bundling and minification, the minified files are created prior to the app's deployment. Bundling and minifying before deployment provides the advantage of reduced server load. However, it's important to recognize that design-time bundling and minification increases build complexity and only works with static files.
60+
The MVC and Razor Pages project templates provide a solution for bundling and minification consisting of a JSON configuration file. Third-party tools, such as the [Grunt](xref:client-side/using-grunt) task runner, accomplish the same tasks with a bit more complexity. A third-party tool is a great fit when your development workflow requires processing beyond bundling and minification—such as linting and image optimization. By using design-time bundling and minification, the minified files are created prior to the app's deployment. Bundling and minifying before deployment provides the advantage of reduced server load. However, it's important to recognize that design-time bundling and minification increases build complexity and only works with static files.
6161

6262
## Configure bundling and minification
6363

@@ -90,109 +90,6 @@ Configuration options include:
9090
* `sourceMap`: Flag indicating whether to generate a source map for the bundled file. **optional**, *default - false*
9191
* `sourceMapRootPath`: The root path for storing the generated source map file.
9292

93-
## Build-time execution of bundling and minification
94-
95-
The [BuildBundlerMinifier](https://www.nuget.org/packages/BuildBundlerMinifier/) NuGet package enables the execution of bundling and minification at build time. The package injects [MSBuild Targets](/visualstudio/msbuild/msbuild-targets) which run at build and clean time. The *bundleconfig.json* file is analyzed by the build process to produce the output files based on the defined configuration.
96-
97-
> [!NOTE]
98-
> BuildBundlerMinifier belongs to a community-driven project on GitHub for which Microsoft provides no support. Issues should be filed [here](https://github.com/madskristensen/BundlerMinifier/issues).
99-
100-
# [Visual Studio](#tab/visual-studio)
101-
102-
Add the *BuildBundlerMinifier* package to your project.
103-
104-
Build the project. The following appears in the Output window:
105-
106-
```console
107-
1>------ Build started: Project: BuildBundlerMinifierApp, Configuration: Debug Any CPU ------
108-
1>
109-
1>Bundler: Begin processing bundleconfig.json
110-
1> Minified wwwroot/css/site.min.css
111-
1> Minified wwwroot/js/site.min.js
112-
1>Bundler: Done processing bundleconfig.json
113-
1>BuildBundlerMinifierApp -> C:\BuildBundlerMinifierApp\bin\Debug\netcoreapp2.0\BuildBundlerMinifierApp.dll
114-
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
115-
```
116-
117-
Clean the project. The following appears in the Output window:
118-
119-
```console
120-
1>------ Clean started: Project: BuildBundlerMinifierApp, Configuration: Debug Any CPU ------
121-
1>
122-
1>Bundler: Cleaning output from bundleconfig.json
123-
1>Bundler: Done cleaning output file from bundleconfig.json
124-
========== Clean: 1 succeeded, 0 failed, 0 skipped ==========
125-
```
126-
127-
# [.NET Core CLI](#tab/netcore-cli)
128-
129-
Add the *BuildBundlerMinifier* package to your project:
130-
131-
```dotnetcli
132-
dotnet add package BuildBundlerMinifier
133-
```
134-
135-
If using ASP.NET Core 1.x, restore the newly added package:
136-
137-
```dotnetcli
138-
dotnet restore
139-
```
140-
141-
Build the project:
142-
143-
```dotnetcli
144-
dotnet build
145-
```
146-
147-
The following appears:
148-
149-
```console
150-
Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core
151-
Copyright (C) Microsoft Corporation. All rights reserved.
152-
153-
154-
Bundler: Begin processing bundleconfig.json
155-
Bundler: Done processing bundleconfig.json
156-
BuildBundlerMinifierApp -> C:\BuildBundlerMinifierApp\bin\Debug\netcoreapp2.0\BuildBundlerMinifierApp.dll
157-
```
158-
159-
Clean the project:
160-
161-
```dotnetcli
162-
dotnet clean
163-
```
164-
165-
The following output appears:
166-
167-
```console
168-
Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core
169-
Copyright (C) Microsoft Corporation. All rights reserved.
170-
171-
172-
Bundler: Cleaning output from bundleconfig.json
173-
Bundler: Done cleaning output file from bundleconfig.json
174-
```
175-
176-
---
177-
178-
## Ad hoc execution of bundling and minification
179-
180-
It's possible to run the bundling and minification tasks on an ad hoc basis, without building the project. Add the [BundlerMinifier.Core](https://www.nuget.org/packages/BundlerMinifier.Core/) NuGet package to your project:
181-
182-
[!code-xml[](../client-side/bundling-and-minification/samples/BuildBundlerMinifierApp/BuildBundlerMinifierApp.csproj?range=10)]
183-
184-
> [!NOTE]
185-
> BundlerMinifier.Core belongs to a community-driven project on GitHub for which Microsoft provides no support. Issues should be filed [here](https://github.com/madskristensen/BundlerMinifier/issues).
186-
187-
This package extends the .NET Core CLI to include the *dotnet-bundle* tool. The following command can be executed in the Package Manager Console (PMC) window or in a command shell:
188-
189-
```dotnetcli
190-
dotnet bundle
191-
```
192-
193-
> [!IMPORTANT]
194-
> NuGet Package Manager adds dependencies to the *.csproj file as `<PackageReference />` nodes. The `dotnet bundle` command is registered with the .NET Core CLI only when a `<DotNetCliToolReference />` node is used. Modify the *.csproj file accordingly.
195-
19693
## Add files to workflow
19794

19895
Consider an example in which an additional *custom.css* file is added resembling the following:
@@ -252,32 +149,7 @@ The following `environment` tag renders the bundled and minified CSS files when
252149
253150
There are cases in which an app's bundling and minification workflow requires additional processing. Examples include image optimization, cache busting, and CDN asset processing. To satisfy these requirements, you can convert the bundling and minification workflow to use Gulp.
254151
255-
### Use the Bundler & Minifier extension
256-
257-
The Visual Studio [Bundler & Minifier](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.BundlerMinifier) extension handles the conversion to Gulp.
258-
259-
> [!NOTE]
260-
> The Bundler & Minifier extension belongs to a community-driven project on GitHub for which Microsoft provides no support. Issues should be filed [here](https://github.com/madskristensen/BundlerMinifier/issues).
261-
262-
Right-click the *bundleconfig.json* file in Solution Explorer and select **Bundler & Minifier** > **Convert To Gulp...**:
263-
264-
![Convert To Gulp context menu item](../client-side/bundling-and-minification/_static/convert-to-gulp.png)
265-
266-
The *gulpfile.js* and *package.json* files are added to the project. The supporting [npm](https://www.npmjs.com/) packages listed in the *package.json* file's `devDependencies` section are installed.
267-
268-
Run the following command in the PMC window to install the Gulp CLI as a global dependency:
269-
270-
```console
271-
npm i -g gulp-cli
272-
```
273-
274-
The *gulpfile.js* file reads the *bundleconfig.json* file for the inputs, outputs, and settings.
275-
276-
[!code-javascript[](../client-side/bundling-and-minification/samples/BuildBundlerMinifierApp/gulpfile.js?range=1-12&highlight=10)]
277-
278-
### Convert manually
279-
280-
If Visual Studio and/or the Bundler & Minifier extension aren't available, convert manually.
152+
### Manually convert the bundling and minification workflow to use Gulp
281153
282154
Add a *package.json* file, with the following `devDependencies`, to the project root:
283155

0 commit comments

Comments
 (0)