Opifex.Uswds
3.1.0
dotnet add package Opifex.Uswds --version 3.1.0
NuGet\Install-Package Opifex.Uswds -Version 3.1.0
<PackageReference Include="Opifex.Uswds" Version="3.1.0" />
paket add Opifex.Uswds --version 3.1.0
#r "nuget: Opifex.Uswds, 3.1.0"
// Install Opifex.Uswds as a Cake Addin
#addin nuget:?package=Opifex.Uswds&version=3.1.0
// Install Opifex.Uswds as a Cake Tool
#tool nuget:?package=Opifex.Uswds&version=3.1.0
USWDS Razor Class Library (RCL)
This project is a .NET Razor class library (RCL) that contains references for ditributable USWDS static assets such as CSS and JS files.
While other integrations for USWDS do exist, there isn't an easy way to reference it in a .NET Blazor app without significant overhead. This package provides a quick and easy reference to include the dist
folder of the USWDS build in your Razor/Blazor projects.
Currently, its use has only been tested with Blazor Client projects, i.e. blazorwasm
, but it only includes static assets, and can potentially be included in any other type of project that can leverage Razor class libraries.
The versioning for this library follows the major and minor release versions of USWDS. Patch versions may differ and suffixes may be added in case siginificant breaking changes need to be addressed.
Getting started
Install the package on your project by using the NuGet package manager using your tool of choice. Methods to install are listed on the NuGet page for the project.
Include references to the CSS and JS files as described in the Documentation as described in the section Using USWDS CSS and JavaScript in your project.
Instead of using the path
assets/uswds/dist/
as specified in the documentation, you will be using the path_content/Opifex.Uswds/
to retrieve the various resources.So the a minimal
index.html
file would look like:<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My Example Project</title> <script src="_content/Opifex.Uswds/js/uswds-init.min.js"></script> <link rel="stylesheet" href="_content/Opifex.Uswds/css/uswds.min.css" /> </head> <body> <script src="_content/Opifex.Uswds/js/uswds.min.js"></script> </body> </html>
This is a consequence of how static assets are packaged in an RCL. To read more about this, see Consume content from a referenced RCL.
For a more in-depth understanding of how to integrate it with a Blazor Client project, see the landing page sample project, which was adapted from the landing page template.
Contributing
Please follow GitHub community guidelines and contribute by opening issues or pull requests accordingly.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.AspNetCore.Components.Web (>= 6.0.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|