### Install WebCompiler as Local .NET Tool
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Installs the WebCompiler tool as a local tool within the current project. This is useful for CI environments.
```bash
dotnet tool install Excubo.WebCompiler
```
--------------------------------
### Call WebCompiler Globally
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Example of calling the globally installed webcompiler to recursively compile files in the 'wwwroot' directory.
```bash
webcompiler -r wwwroot
```
--------------------------------
### Install WebCompiler as Global .NET Tool
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Installs the WebCompiler tool globally using the .NET CLI. This allows you to call 'webcompiler' from any directory.
```bash
dotnet tool install Excubo.WebCompiler --global
```
--------------------------------
### Create Local Tool Manifest
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Initializes a local tool manifest in the current directory. This is required before installing local tools.
```bash
dotnet new tool-manifest
```
--------------------------------
### Call Local WebCompiler Tool
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Invokes the locally installed webcompiler tool to display help information.
```bash
dotnet tool webcompiler -h
```
--------------------------------
### Run Local WebCompiler Tool via 'dotnet webcompiler'
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Executes the locally installed webcompiler directly using 'dotnet webcompiler'. This command recursively compiles files in the 'wwwroot' directory.
```powershell
dotnet webcompiler -r wwwroot
```
--------------------------------
### Run Local WebCompiler Tool via 'dotnet run tool'
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Executes the locally installed webcompiler using 'dotnet run tool'. This command recursively compiles files in the 'wwwroot' directory.
```powershell
dotnet run tool webcompiler -r wwwroot
```
--------------------------------
### Restore Local Tools
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Restores local .NET tools defined in the manifest. This should be run after installing or updating local tools.
```bash
dotnet tool restore
```
--------------------------------
### MSBuild Targets for Local dotnet tool Installation and Execution
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
These MSBuild targets ensure local `dotnet` tools are restored and then execute the WebCompiler. The `ToolRestore` target runs `dotnet tool restore` before the build, and `PreBuild` executes `dotnet tool run webcompiler`.
```xml
```
--------------------------------
### MSBuild Target for Updating Local dotnet tool
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
This MSBuild target ensures the latest version of the `excubo.webcompiler` `dotnet` tool is installed or updated. It runs `dotnet tool update excubo.webcompiler` before the `PreBuildEvent`.
```xml
```
--------------------------------
### MSBuild Target for Global WebCompiler Execution
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
This MSBuild target conditionally executes the WebCompiler only if it's installed globally. It checks for Razor project context to disable compression and logs errors without failing the build if the tool is not found. Compression is enabled by default unless in a Razor Class Library.
```xml
disabled
enabled
```
--------------------------------
### WebCompiler Command Line Usage
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Displays the available command-line options for the webcompiler. Use -r to recursively search folders for compilable files.
```bash
Usage:
webcompiler file1 file2 ... [options]
webcompiler [options]
Options:
-c|--config Specify a configuration file for compilation.
-d|--defaults [conf.json] Write a default configuration file (file name is webcompilerconfiguration.json, if none is specified).
-f|--files Specify a list of files that should be compiled.
-h|--help Show command line help.
-m|--minify [disable/enable] Enable/disable minification (default: enabled), ignored if configuration file is provided.
-o|--output-dir Specify the output directory, ignored if configuration file is provided.
-p|--preserve [disable/enable] Enable/disable whether to preserve intermediate files (default: enabled).
-r|--recursive Recursively search folders for compilable files (only if any of the provided arguments is a folder).
-z|--zip [disable/enable] Enable/disable gzip (default: enabled), ignored if configuration file is provided.
-a|--autoprefix [disable/enable] Enable/disable autoprefixing (default: enabled), ignored if configuration file is provided.
```
--------------------------------
### Run WebCompiler with Custom Configuration
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Executes WebCompiler using a specified root directory and a custom configuration file. The `-r` flag specifies the root directory, and `-c` points to the configuration file.
```bash
webcompiler -r wwwroot -c webcompilerconfiguration.json
```
--------------------------------
### Configure File and Folder Ignoring
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Specify 'IgnoreFolders' and 'IgnoreFiles' to exclude specific directories and files when using recursive mode. Subfolders must be explicitly listed if they are to be ignored.
```json
{
"CompilerSettings": {
"IgnoreFolders": ["./wwwroot/", "./bin/", "./obj/", "./wwwroot/sass/"],
"IgnoreFiles": ["./sass/_variables.scss"]
}
}
```
--------------------------------
### Generate Default WebCompiler Configuration
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Creates a default configuration file named 'webcompilerconfiguration.json'. This file can then be modified to customize the compilation and minification process.
```bash
webcompiler --defaults
```
--------------------------------
### dotnet watch Compile-on-Save Configuration
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
This configuration snippet for a `.csproj` file enables `dotnet watch` to monitor SCSS files for changes and trigger recompilation. Specify file extensions as needed.
```xml
```
--------------------------------
### Integrate WebCompiler into MSBuild
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Adds a custom MSBuild target to execute the webcompiler during the build process. This ensures assets are compiled automatically.
```xml
```
--------------------------------
### Configure File Ignoring with Globbing
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Use the 'Ignore' key with file globbing patterns to exclude specific files and folders during compilation. If no 'Ignore' value is defined, files prefixed with '_' are ignored by default.
```json
{
"CompilerSettings": {
"Ignore": [ "**/_*.*", "wwwroot/*.scss", "wwwroot/css/specific-file.scss", "wwwroot/_lib/**/*.scss", "bin/**/*", "obj/**/*" ]
}
}
```
--------------------------------
### Default WebCompiler Configuration JSON
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
The default JSON configuration for WebCompiler, specifying settings for minifiers (GZip, CSS, Javascript), autoprefixing, and compiler settings (Sass).
```json
{
"Minifiers": {
"GZip": true,
"Enabled": true,
"Css": {
"CommentMode": "Important",
"ColorNames": "Hex",
"TermSemicolons": true,
"OutputMode": "SingleLine",
"IndentSize": 2
},
"Javascript": {
"RenameLocals": true,
"PreserveImportantComments": true,
"EvalTreatment": "Ignore",
"TermSemicolons": true,
"OutputMode": "SingleLine",
"IndentSize": 2
}
},
"Autoprefix": {
"Enabled": true,
"ProcessingOptions": {
"Browsers": [
"last 4 versions"
],
"Cascade": true,
"Add": true,
"Remove": true,
"Supports": true,
"Flexbox": "All",
"Grid": "None",
"IgnoreUnknownVersions": false,
"Stats": "",
"SourceMap": true,
"InlineSourceMap": false,
"SourceMapIncludeContents": false,
"OmitSourceMapUrl": false
}
},
"CompilerSettings": {
"Sass": {
"OutputStyle": "Expanded",
"RelativeUrls": true,
"SourceMap": false
}
},
"Output": {
"Preserve": true
}
}
```
--------------------------------
### Configure Sass Compilation Options
Source: https://github.com/excubo-ag/webcompiler/blob/main/README.md
Customize Sass compilation settings including indentation, output style, and URL handling. Note that 'Nested' output style is no longer supported, and the 'Precision' property has been removed.
```json
{
"CompilerSettings": {
"Sass": {
"IndentType": "Space",
"IndentWidth": 2,
"OutputStyle": "Expanded",
"RelativeUrls": true,
"LineFeed": "Lf",
"SourceMap": false
}
}
}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.