Wangkanai.Responsive
2.0.0-beta4
Prefix Reserved
See the version list below for details.
dotnet add package Wangkanai.Responsive --version 2.0.0-beta4
NuGet\Install-Package Wangkanai.Responsive -Version 2.0.0-beta4
<PackageReference Include="Wangkanai.Responsive" Version="2.0.0-beta4" />
paket add Wangkanai.Responsive --version 2.0.0-beta4
#r "nuget: Wangkanai.Responsive, 2.0.0-beta4"
// Install Wangkanai.Responsive as a Cake Addin
#addin nuget:?package=Wangkanai.Responsive&version=2.0.0-beta4&prerelease
// Install Wangkanai.Responsive as a Cake Tool
#tool nuget:?package=Wangkanai.Responsive&version=2.0.0-beta4&prerelease
ASP.NET Core Responsive
ASP.NET Core Responsive middleware for routing base upon request client device detection to specific view. Being to target difference client devices with seperation of concern is crucial, due to you can mininize what is sent to the client directly from the service to only what is needed and nothing more. This increase performance and lower bandwidth usage.
Installation
Installation of Responsive library will bring in all dependency packages.
PM> install-package Wangkanai.Responsive -pre
Configure Service
Responsive is configured in the ConfigureServices
method:
public void ConfigureServices(IServiceCollection services)
{
// Add responsive services.
services.AddResponsive()
.AddViewSuffix()
.AddViewSubfolder();
// Add framework services.
services.AddMvc();
}
AddResponsive()
Adds the Responsive services to the services container.AddViewSuffix()
Adds support for device view files toSuffix
. In this sample view Responsive is based on the view file suffix.Ex
*views/[controller]/[action]/index.mobile.cshtml*
AddViewSubfolder()
Adds support for device view files toSubfolder
. In this sample view Responsive is based on the view file subfolder.Ex
*views/[controller]/[action]/mobile/index.cshtml*
Configure Middleware
The current device on a request is set in the Responsive middleware. The Responsive middleware is enabled in the Configure
method of Startup.cs file.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseResponsive();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
UseResponsive()
Add the responsive middleware into the http pipeline. Its will capture the request and resolve the device to responsive services container.
Customized able options (beta 3)
This enable the middleware to customized the default response for any type of request device to the configured options.
app.UseResponsive(new ResponsiveOptions
{
TabletDefault = DeviceType.Mobile
});
ResponsiveOptions
has 3 default configurable viaDesktopDefault
,TabletDefault
, andMobileDefault
.
Directory Structure
src
- The code of this project lives heretest
- Unit tests of this project to valid that everything pass specssample
- Contains sample web application of usage
Contributing
All contribution are welcome, please contact the author.
Related projects
See the LICENSE file.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.AspNetCore.Mvc.Abstractions (>= 2.0.0)
- Microsoft.AspNetCore.Mvc.Razor (>= 2.0.0)
- Microsoft.Extensions.DependencyInjection (>= 2.0.0)
- Wangkanai.Detection.Device (>= 2.0.0-beta7)
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 | |
---|---|---|---|
7.8.0 | 1,427 | 11/27/2023 | |
7.7.0 | 480 | 11/23/2023 | |
7.6.0 | 499 | 11/17/2023 | |
7.5.0 | 498 | 11/15/2023 | |
7.4.0 | 83 | 11/1/2023 | |
7.3.0 | 188 | 10/22/2023 | |
7.2.0 | 88 | 9/28/2023 | |
7.1.0 | 69 | 9/21/2023 | |
7.0.0 | 786 | 7/20/2023 | |
6.2.0 | 888 | 7/7/2023 | |
6.1.0 | 728 | 7/1/2023 | |
6.0.0 | 774 | 6/28/2023 | |
5.4.0 | 1,181 | 6/16/2023 | |
5.3.1 | 939 | 6/7/2023 | |
5.3.0 | 1,105 | 5/15/2023 | |
5.2.0 | 768 | 5/11/2023 | |
5.1.1 | 920 | 4/13/2023 | |
5.1.0 | 1,246 | 4/3/2023 | |
5.0.0 | 978 | 1/18/2023 | |
4.10.4 | 913 | 1/17/2023 | |
4.10.3 | 926 | 1/10/2023 | |
4.10.2 | 994 | 1/3/2023 | |
4.10.1 | 914 | 12/31/2022 | |
4.10.0 | 3,230 | 12/27/2022 | |
4.9.0 | 961 | 12/23/2022 | |
4.8.0 | 1,028 | 11/30/2022 | |
4.7.0 | 896 | 11/28/2022 | |
4.6.0 | 927 | 11/27/2022 | |
4.5.0 | 958 | 11/26/2022 | |
4.4.0 | 929 | 11/24/2022 | |
4.3.0 | 969 | 11/24/2022 | |
4.2.0 | 966 | 11/15/2022 | |
4.1.0 | 975 | 11/9/2022 | |
4.0.0 | 950 | 11/9/2022 | |
3.5.2 | 1,933 | 9/27/2022 | |
3.5.1 | 1,055 | 9/19/2022 | |
3.5.0 | 1,282 | 9/13/2022 | |
3.4.0 | 1,025 | 9/13/2022 | |
3.3.300 | 1,070 | 9/9/2022 | |
3.3.200 | 1,255 | 8/23/2022 | |
3.3.100 | 1,021 | 8/21/2022 | |
3.2.0 | 2,321 | 6/23/2022 | |
3.1.0 | 1,820 | 3/6/2022 | |
3.0.0 | 2,203 | 2/9/2022 | |
3.0.0-alpha3 | 735 | 2/9/2022 | |
3.0.0-alpha2 | 722 | 2/8/2022 | |
3.0.0-alpha1 | 745 | 2/4/2022 | |
2.0.1 | 25,588 | 9/25/2020 | |
2.0.0 | 18,043 | 12/29/2019 | |
2.0.0-beta15 | 1,320 | 12/27/2019 | |
2.0.0-beta14 | 1,194 | 12/25/2019 | |
2.0.0-beta13 | 1,524 | 12/8/2019 | |
2.0.0-beta12 | 3,649 | 8/2/2019 | |
2.0.0-beta11 | 2,021 | 5/2/2019 | |
2.0.0-beta04 | 1,411 | 5/3/2019 |