Getting started

edit

Install the tool

Install it as a global tool:

dotnet tool install --global Meziantou.Framework.Html.Tool

The tool needs the ASP.NET Core runtime: the .NET SDK includes it.

Run a command

The tool has three commands. Each one takes the file to update, --single-file, or a glob pattern, --file-pattern:

meziantou.html append-version --single-file wwwroot/index.html
meziantou.html append-version --file-pattern "**/*.html" --root-directory wwwroot
CommandDescription
replace-valueSets the text of the elements, or the values of the attributes, that an XPath expression selects. See Replacing values.
append-versionAppends a version computed from the content of the file to the URLs of local files. See Appending versions.
inline-resourcesReplaces the references to local scripts, style sheets and images with their content. See Inlining resources.

The files are updated in place: run the tool on a copy, such as the output folder of a build, not on your sources.

Read the output

For each file, the tool writes the number of nodes it changed:

Updated 3 nodes in 'wwwroot/index.html'

It exits with code 0 when it succeeds. A missing required option, an invalid glob pattern or a file that cannot be read gives a message on the standard error and a non-zero exit code.

meziantou.html --help lists the commands, and meziantou.html <command> --help the options of a command.

Next steps