Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

How can I raw js&css more convenient by code?

$
0
0

I want to show different css&js  in different browsers.

I do it like this:

string APPJS = "";
string APPCSS = "";
if (G.IsIE == true)
{
APPJS = "<script type='text/javascript' src=/lib/jquery-1.12.4.min.js></script>";
APPJS += "<script type='text/javascript' src=/js/appIE.min.js></script>";
}
else
{
APPCSS = "<link rel='stylesheet' href = '/css/animate.min.css' >";
APPJS = "<script src=/lib/jquery-3.2.1.min.js></script>";
APPJS = "<script src=/lib/wow.min.js></script>";
APPJS += "<script src=/js/app.min.js></script>";
APPJS += "<script type='text/javascript' src=/js/app.min.js></script>";
}

Yes, it works. However, every time I add/edit some CSS or js, it will take me some minute to check if the string I add is right. What's more, I think my way is not the best way to achieve this.

Is there any way better to achieve this? Thank you.


Viewing all articles
Browse latest Browse all 9386

Trending Articles