Last active
January 16, 2019 22:29
-
-
Save EdCharbeneau/07d73d170baf17d4988a0ef601882730 to your computer and use it in GitHub Desktop.
Kendo UI css dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "1.0", | |
"defaultProvider": "unpkg", | |
"libraries": [ | |
{ | |
"library": "@progress/kendo-theme-default@3.0.0", | |
"destination": "wwwroot/css/kendo-default", | |
"files": [ | |
"dist/all.css" | |
] | |
}, | |
{ | |
"library": "@progress/kendo-theme-bootstrap@3.0.0", | |
"destination": "wwwroot/css/kendo-bootstrap", | |
"files": [ | |
"dist/all.css" | |
] | |
}, | |
{ | |
"library": "@progress/kendo-theme-material@2.0.0", | |
"destination": "wwwroot/css/kendo-material", | |
"files": [ | |
"dist/all.css" | |
] | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select onchange=@HandleThemeChange> | |
@foreach (var t in themes) | |
{ | |
<option value=@t>@t</option> | |
} | |
</select> | |
@functions { | |
string[] themes = { "Default", "Bootstrap", "Material" }; | |
async void HandleThemeChange(UIChangeEventArgs e) | |
{ | |
string themePath = $"css/kendo-{e.Value}/dist/all.css".ToLower(); | |
await Microsoft.JSInterop.JSRuntime.Current.InvokeAsync<string>("theme.changeCss", themePath); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.theme = { | |
changeCss: function (cssFile) { | |
var oldlink = document.getElementById("kendoCss"); | |
var newlink = document.createElement("link"); | |
newlink.setAttribute("id", "kendoCss"); | |
newlink.setAttribute("rel", "stylesheet"); | |
newlink.setAttribute("type", "text/css"); | |
newlink.setAttribute("href", cssFile); | |
document.getElementsByTagName("head").item(0).replaceChild(newlink, oldlink); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment