CssInCSharp 0.1.0-nightly-240110064300
This is a prerelease version of CssInCSharp.
dotnet add package CssInCSharp --version 0.1.0-nightly-240110064300
NuGet\Install-Package CssInCSharp -Version 0.1.0-nightly-240110064300
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CssInCSharp" Version="0.1.0-nightly-240110064300" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CssInCSharp --version 0.1.0-nightly-240110064300
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CssInCSharp, 0.1.0-nightly-240110064300"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CssInCSharp as a Cake Addin
#addin nuget:?package=CssInCSharp&version=0.1.0-nightly-240110064300&prerelease
// Install CssInCSharp as a Cake Tool
#tool nuget:?package=CssInCSharp&version=0.1.0-nightly-240110064300&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CssInCSharp
A lib for generating Style Sheets with C#.
Getting started
dotnet add package CssInCSharp
Usage
<div class="basic">
<div class="title">Title</div>
<button class="button">Click</button>
</div>
<style>
@_css
</style>
@code
{
private string _css = string.Empty;
protected override void OnInitialized()
{
_css = new CSSObject
{
[".basic"] = new CSSObject
{
Width = 300,
Height = 300,
Border = "1px solid #DDD",
["& .title"] = new CSSObject
{
LineHeight = 20,
Color = "red"
},
["& .button"] = new CSSObject
{
Width = "100%",
Height = "20px",
TextAlign = "center",
["&:hover"] = new CSSObject
{
Color = "blue"
}
}
}
}.ToString();
}
}
For other examples, you can check out the example code.
Css Compiler
The CssInCSharp is similar to less or sass. You can simply convert you style file into C# class, so that you can make full use of the C# language features to generate style content.
Benchmark
BenchmarkDotNet=v0.13.5, OS=Windows 11 (10.0.22621.1702/22H2/2022Update/SunValley2)
AMD Ryzen 7 5700G with Radeon Graphics, 1 CPU, 16 logical and 8 physical cores
.NET SDK=7.0.203
[Host] : .NET 7.0.5 (7.0.523.17405), X64 RyuJIT AVX2
DefaultJob : .NET 7.0.5 (7.0.523.17405), X64 RyuJIT AVX2
Method | Mean | Error | StdDev | Median | Gen0 | Gen1 | Allocated |
---|---|---|---|---|---|---|---|
CreateCss | 39.71 μs | 0.789 μs | 1.595 μs | 38.98 μs | 17.6392 | 1.0376 | 144.29 KB |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. 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 is compatible. 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 is compatible. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Microsoft.AspNetCore.Components.Web (>= 3.1.0)
-
net5.0
- Microsoft.AspNetCore.Components.Web (>= 5.0.0)
-
net6.0
- Microsoft.AspNetCore.Components.Web (>= 6.0.0)
-
net7.0
- Microsoft.AspNetCore.Components.Web (>= 7.0.0)
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.0)
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 |
---|---|---|
0.1.0-nightly-240110064300 | 86 | 1/10/2024 |
0.1.0-nightly-231229073125 | 81 | 12/29/2023 |
0.1.0-nightly-231229024140 | 67 | 12/29/2023 |
0.1.0-nightly-231225064316 | 60 | 12/25/2023 |
0.1.0-nightly-231222093849 | 59 | 12/22/2023 |
0.1.0-nightly-231218032026 | 71 | 12/18/2023 |
0.1.0-nightly-231215093440 | 76 | 12/15/2023 |
0.1.0-nightly-231214104150 | 65 | 12/14/2023 |
0.1.0-nightly-231213123405 | 64 | 12/13/2023 |
0.1.0-nightly-231212143446 | 61 | 12/12/2023 |
0.1.0-nightly-231211073331 | 68 | 12/11/2023 |
0.1.0-nightly-231202142232 | 76 | 12/2/2023 |
0.1.0-nightly-231202062218 | 58 | 12/2/2023 |
0.1.0-nightly-231202054543 | 61 | 12/2/2023 |