Since I use NancyFX in Visual Studio, I had to find my own way. Randell as they show you how to automate deployments from VSTS to Octopus Deploy, and demo the new VSTS Octopus Deploy dashboard widget. Sponsor: Did you know VSTS can integrate closely with Octopus Deploy? Join Damian Brady and Brian A. I've found this to be a good balance that can get quickly productive with a project that gets bundling without npm/node, but I can easily grow to a larger, more npm/bower/gulp-driven front-end developer-friendly app. Now you'll get a gulpfile.js that uses the bundleconfig.json and you've got full control:Īnd during the conversion you'll get the npm packages you need to do the work automatically: If you outgrow this bundler or just like Gulp, you can right click and Convert to Gulp! $ dotnet run Advanced: Using Gulp to handle Bundling/Minifying $ dotnet add package BuildBundlerMinifier Here's how it would work entirely from the command prompt: $ dotnet new mvc This is nice for VS Code or users of other editors. even from the command line with "dotnet build." It's all integrated. WebApplication8 -> c:\WebApplication8\bin\Debug\netcoreapp1.1\WebApplication8.dll All rights reserved.īundler: Begin processing bundleconfig.jsonīundler: Done processing bundleconfig.json c:\WebApplication8\WebApplication8>dotnet buildĬopyright (C) Microsoft Corporation. If you have the VSIX installed, just right-click the bundleconfig.json and click "Enable bundle on build." and you'll get the NuGet package.Note that this adds it to your csproj without you having to edit it! It's like "nuget install" but adds references to projects! The dotnet CLI is lovely.Add it from the command line via "dotnet add package BuildBundlerMinifier".Add it from the Manage NuGet Packages menu.You can add this NuGet package SEVERAL ways. The VSIX (VS extension) gives you the small menu and some UI hooks, but if you want to have your bundles updated at build time (useful if you don't use VS!) then you'll want to add a NuGet package called BuildBundlerMinifier. You can manually update your Bundles with this item as well as see settings and have bundling show up in the Task Runner Explorer. Right click on your project and you'll see this Bundler & Minifier menu: They are next to them on the disk, but this hierarchy is a nice way to see that they are associated, and that one generates the other. See under site.css and site.js? There are associated minified versions of those files. If getting a prompt like this bugs you, you can turn all prompting off here: Slip this UI section if you just want Build-time bundling. VS knows you're in a bundleconfig.json and in order to use it effectively in VS you grab a small extension. At the top of the VS editor you'll see this yellow prompt. Optionally specify minification options "outputFileName": "// An array of relative input file paths. In my Solution Explorer is a "bundleconfig.json" like this: // Configure bundling and minification for the project. It's just minutes to enable and it's quite nice. Bundling isn't on by default but the configuration you need IS included by default. I'm in Visual Studio 2017 and I go File | New Project | ASP.NET Core Web App. So how do you find balance? Here's how it works. Additionally, some devs don't need the Grunt/Gulp/npm overhead while others absolutely do. The key is to find a balance that gives you easy access to development versions of JS/CSS assets when at dev time, while making it "zero work" to put minified stuff into production. There's runtime bundling on ASP.NET 4.x but in recent years web developers have used tools like Grunt or Gulp to orchestrate a client-side build process to squish their assets. Maria and I were updating the NerdDinner sample app (not done yet, but soon) and were looking at various ways to do bundling and minification of the JSS and CS.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |