WebCondenser compiles Sass and JSX, then bundles and minifies JavaScript and CSS, for .NET web projects. It is the successor to Bundler & Minifier and Web Compiler, and it reads their configuration files as they are.
Alpha (early access). WebCondenser is new and still changing. Expect rough edges, and settings or commands may change before version 1.0. Please report problems in the issue tracker.
It comes in three parts that share the same core and the same configuration:
- a Visual Studio extension (2022 and 2026) that rebuilds your outputs as you save
- a NuGet build package that does the same work in
dotnet build, MSBuild and CI
- a command-line tool for everything else
It runs esbuild, Dart Sass and, for projects that ask for it, Lightning CSS directly, so there is no Node.js to install. It runs on Windows, x64 and arm64.
WebCondenser is free. If it is useful to you or your company, you can support its upkeep through GitHub Sponsors.
Quick start
1. Install
Pick the parts you need. They work together. During the alpha the two NuGet packages are prereleases, which is why the commands below say --prerelease; in Visual Studio's package manager, tick Include prerelease to see them.
Visual Studio extension. In Visual Studio 2022 (17.14 or later) or 2026, open Extensions > Manage Extensions, search for WebCondenser and install it.
Build package. Add it to the web project:
dotnet add package WebCondenser.Build --prerelease
In Visual Studio, right-click the project and choose WebCondenser > Enable Compile on Build to do the same. Disable Compile on Build, in the same place once the package is there, takes it out again.
Command-line tool. It needs the .NET 10 runtime or later:
dotnet tool install --global WebCondenser.Cli --prerelease
2. Say what to build
Put a webcondenser.json in the project folder. webcondenser init writes a starter, and so do the extension's Add to Compile List and Add to Bundle... commands on a file in Solution Explorer.
{
// Sass files to compile, each to one stylesheet.
"compile": [
{
"inputFile": "Styles/site.scss",
"outputFile": "wwwroot/css/site.css",
"minify": {
"enabled": true
},
"sourceMap": false
}
],
// Files to join into one and minify, in the order listed.
"bundles": [
{
"outputFileName": "wwwroot/js/site.min.js",
"inputFiles": [
"wwwroot/js/one.js",
"wwwroot/js/two.js"
],
"minify": {
"enabled": true
},
"sourceMap": false
}
]
}
This writes site.css, a minified site.min.css beside it, and site.min.js. minify and sourceMap are optional and shown with their defaults: set "enabled": false to compile or join without minifying, and "sourceMap": true to write a source map. Stylesheets are compiled before the bundles are made, so a bundle can take a compiled stylesheet as input. inputFiles accepts files, folders, glob patterns and ! exclusions.
Every setting, including the minify options, the Sass options and Lightning CSS, is described in CONFIGURATION.md. An editor can offer the settings as you type; see Completion in the editor.
3. Build
- Extension: save a source file and its outputs are rebuilt. The WebCondenser menu under Extensions, and on a right-click of the solution, acts on every project. To act on one file or project, right-click it in Solution Explorer and use its WebCondenser menu. Problems are listed in the Error List, and in the WebCondenser pane of the Output window with everything else a build says.
- Build package: build the project as usual. Clean deletes the generated files.
- Command-line tool: run
webcondenser in the project folder. webcondenser --help lists every command and option.
Coming from Bundler & Minifier or Web Compiler
The command-line tool and the build package read an existing bundleconfig.json and compilerconfig.json (with its compilerconfig.json.defaults) without changes.
The Visual Studio extension builds on save only in a project that has a webcondenser.json. A project with just the old files is left to the old extensions, so both can stay installed while you move one project at a time. The menu commands still work on the old files when you run them yourself.
The old files are a fallback, list by list. A webcondenser.json with no bundles list takes the bundles from bundleconfig.json, and one with no compile list takes the compile entries from compilerconfig.json. So you can add a webcondenser.json that holds only settings (engines, target, cssMinifier) while the old files go on saying what to build; those settings apply to their entries too. Once webcondenser.json has a list of its own, the old file for that list is ignored with a warning.
To move the old files into webcondenser.json, run webcondenser import, or use Import into webcondenser.json on either file in Visual Studio. Entries and comments are carried over, anything that could not be is listed in the output, and the old files are renamed to .bak. The command line imports both files unless told otherwise (--no-bundles, --no-compile); the Visual Studio command imports the file it is run on, so a project can move one at a time.
In a project WebCondenser builds, keep the old tools away from the same files, or they are processed twice. Importing does that for the old extensions, because they no longer find their files; uninstalling them does it for every project. Remove the old build packages (such as BuildBundlerMinifier and BuildWebCompiler2022) from a project that references WebCondenser.Build.
What is different:
- Minification is done by esbuild, not NUglify. The output is equivalent but not byte for byte the same, and options that only NUglify understood are ignored with a warning.
- Sass (
.scss and .sass) and scripts (.jsx, .es6 and .js) are compiled. Entries for LESS, Stylus and other languages are skipped with a warning.
- Scripts are compiled by esbuild, not Babel, and are no longer turned into ES5: JSX is rewritten and the rest of the syntax is left as written. An import says so once. See Compiling scripts.
- HTML bundles are skipped with a warning.
TypeScript and other steps that make scripts
The build package runs early in a build, before the project is compiled. A bundle whose input is made later in the same build, as a script compiled from TypeScript is, gets the previous build's copy of it, and on a clean checkout none at all. Name the targets that make those files in the project file, and they run first:
<PropertyGroup>
<WebCondenserBuildDependsOn>SetTscExecutable;RunTscCompile</WebCondenserBuildDependsOn>
</PropertyGroup>
Those are the targets of Microsoft.TypeScript.MSBuild 7. Versions before 7 use FindConfigFiles;CompileTypeScript;CompileTypeScriptWithTSConfig, which was checked with 6.0.3. Any other target of the project can be named the same way.
The Visual Studio extension needs none of this: it rebuilds a bundle whenever one of its input files changes, whatever wrote it.
Engines
esbuild and Dart Sass come inside the build package. Without it they are downloaded from the npm registry on first use into %LOCALAPPDATA%\WebCondenser\tools, and each download is verified before it is run.
Lightning CSS is optional and is fetched only by a project that uses it: for vendor prefixes (autoPrefix), or as the stylesheet minifier, chosen for the whole project with "cssMinifier": "lightningcss" or for one bundle with "minify": { "engine": "lightningcss" }.
Choosing versions
Each release of WebCondenser has a default version of every engine. To give the whole team and the build server a different one, pin it in webcondenser.json:
{
"engines": {
"esbuild": "0.28.2",
"sass": "1.108.2",
"lightningcss": "1.33.0"
}
}
A pin is an exact version, and it wins over the copy in the build package. In Visual Studio, Extensions > WebCondenser > WebCondenser Settings... lists the published versions to pick from and writes the pin for you. On the command line, --esbuild-version, --sass-version and --lightningcss-version override the pin for one run, and webcondenser engines shows which versions a project uses and where they come from.
Each release carries the hashes of the engine versions it knows. Any other version still has its npm registry signature checked, but is downloaded only once you approve it. Visual Studio and the command line ask. A build with no one to ask needs --allow-unlisted-engines, WEBCONDENSER_ALLOW_UNLISTED_ENGINES=1, or <WebCondenserAllowUnlistedEngines>true</WebCondenserAllowUnlistedEngines> in the project file.
Visual Studio and the command line run the copy inside a project's build package only when it is a version they have hashes for. A package that carries any other version still sets the version, but the engine itself is fetched as above. The package's own build step runs the engines it came with.
Where engines come from
These settings belong to the machine or the user, never to the project, so opening a repository cannot change where programs are downloaded from.
| Setting |
Settings window |
Command line |
Environment variable |
npm-compatible registry tried before registry.npmjs.org, such as a company mirror |
Package source |
--mirror <url> |
WEBCONDENSER_ENGINE_MIRROR |
| Folder the engines are kept in |
Engine cache folder |
--engine-cache <folder> |
WEBCONDENSER_ENGINE_CACHE |
| Never download |
Work offline |
--offline |
WEBCONDENSER_OFFLINE=1 |
| Use this copy of an engine |
|
--esbuild-path, --sass-path, --lightningcss-path |
WEBCONDENSER_ESBUILD, WEBCONDENSER_SASS, WEBCONDENSER_LIGHTNINGCSS |
A command-line option wins over an environment variable, which wins over the settings window. The window stores its choices in %LOCALAPPDATA%\WebCondenser\settings.json, and the command-line tool and the build package read them too.
For a machine without internet access, webcondenser seed-engines fills the cache ahead of time.
Files outside the solution
A configuration file can name an output anywhere on the computer. The Visual Studio extension builds on every save, so it writes and cleans only inside the project's folder and its solution's. For any other folder it asks once. A yes is kept in %LOCALAPPDATA%\WebCondenser\settings.json under outputFolders, where it can be removed again; a no lasts until Visual Studio closes, and the entry is reported as an error and not written.
The command-line tool and the build package write wherever the configuration says. Running a build already means trusting the project.
Built with AI assistance
WebCondenser is developed interactively with an AI coding assistant, Claude Code. The architecture, the design decisions and the scope come from its maintainer, drawing on experience maintaining the official continuations of Bundler & Minifier and Web Compiler. The assistant writes much of the code, tests and documentation within that design, in a back-and-forth of proposing, testing and correcting.
The work follows ordinary engineering practice:
- The design was written down before the code, and the risky parts were proven with small experiments first.
- An automated test suite runs on .NET 10 and .NET Framework 4.8.
- Output is compared, on real applications, with that of the tools WebCondenser replaces.
- The extension is exercised in a running Visual Studio, not only in unit tests.
Licence
WebCondenser is released under the MIT licence.
The engines it runs are separate programs under their own licences: esbuild (MIT), Dart Sass (MIT) and, for projects that ask for it, Lightning CSS (MPL-2.0). The build package carries the first two; see THIRD-PARTY-NOTICES.txt.