Issue with Bundling and Minification of CSS after NuGet update (ASP MVC 4) - asp.net-mvc

I just ran a Update-Package on a fresh asp mvc 4 project using the mobile template. Update-Package updates every nuget packages in the project and Web.Optimization did not get updated. After the update won't it render the css bundle when I use "Debug="false" in web config, though it worked before the update. Anyone have had simlar problems? I've done no changes to the code.
It works as it should when I set "Debug=true", but then it's not bundeling and minifying the css. When I load the page in a browser and open the developer tools (like firebug) can I still both find and view the minified css file. Any suggestions or ideas would be greatly appriciated.

Related

Tailwind CSS for ASP.NET Core MVC

I have been going through all kinds of tutorials they are either just straight up not useful or they are using previous versions of VS and/or ASP.NET.
How do you install tailwind CSS on an MVC project?
I wish they had published the lib for everyone to copy and paste in their resource file and use it freely.
How do you install tailwind css on a MVC project? I wish they had published the lib for everyone to copy and paste in their resource file and use it freely.
You can try to include tailwind css from CDN, like below.
<link href="https://unpkg.com/tailwindcss#^2/dist/tailwind.min.css" rel="stylesheet">
Besides, you can try to finding client-side libraries and add the required files to your project through the Add Client-Side Library dialog.
I've created this package that's adding a new build action.
You simply set the PackageReference and set the build action of your stylesheet to TailwindCSS. During the build process, the stylesheet will be converted via PostCSS.
For more details, you can take a look at its GitHub repo.

C# MVC5 Upgrade broke Javascript loading

Just upgraded a very old project from MVC 4 to 5 and now after the upgrade the Razor Partial views which were working fine no longer work.
By this I mean that in the partial views there is a Script file that is called at the bottom:
<script src="~/Scripts/simAvail.js" type="text/javascript"></script>
And this was loading the JS and in that file some JQuery added CSS etc as needed to the elements on the page. However after the upgrade this JS file is no longer loaded and I use this method on many pages in the project so wondered if anyone knows the reason why.
The data in the Partial view is loaded and displayed but all the styling and reading/posting of the changes via Ajax is no longer there as this is what the JS file adds to the page.
Thanks
I Managed to fix this it turns out that when the upgrade to MVC5 happened part of the process as detailed on the MS instructions was to re-install all the Nuget's. This part actually installed the latest versions of all the JS packages like JQuery/Knockout etc without me noticing.
This then caused there to be two versions of everything being loaded and thus caused the issue. SO I deleted the old version of the JS packages and back running.

Razor views not generating html after deploying Umbraco 7.2 in IIS 7

I am new to Umbraco, so I started creating a site to play a bit with it. While I had my site running on IIS express (either from VS or WebMatrix) everything worked fine. After deploying the site to IIS 7, the razor views of the front end are display in plain text, meaning that I actually see Razor syntax in the browser. Umbraco back office is working perfect though, except when I hit preview, in that case I get the plain Razor syntax again. I then try to deploy a simple new MVC project to IIS and the Razor engine worked just fine, so I guess is not a problem in IIS but in Umbraco configuration. Is there any configuration tweak I need to take care in Umbraco configuration to solve this problem? Thanks in advance for the help.
I also tried to deploy it in the IIS of my local development machine (the same in which it runs OK in IIS-express) which has the right framework and everything and I got the same cshtml display in the browser.
After struggling a bit more with the problem I found the issue causing this behavior. After installing the starter kit a lot of files are generated in the folder and subfolders of the solution. In order to publish the solution to generate the contents of your website the VS project needs to have all these files included as project files. I found out that some views were excluded of the project and thus not being generated when publishing. I included the missing views and double check that all important files were part of the project and problem solved.

Unable to Bundle JQuery Mobile 1.2 in ASP.NET MVC 4 app

I'm working on an ASP.NET MVC 4 app. This app leverages bundling to improve performance. Previously, the app was using jquery.mobile-1.1.0.js. Everything worked fine. However, I've upgraded to JQuery Mobile 1.2 and when I load my screen, I always see a wait spinner. I've pinpointed it to the fact that both the standard and the minified versions are being referenced. When I look in my view-source after the page is loaded, I see the following at the top:
<script src="/Scripts/jquery.mobile-1.2.0.js"></script>
<script src="/Scripts/jquery.mobile-1.2.0.min.js"></script>
From what I can tell, this was generated from the following in my ASP.NET MVC .cshtml file
#Scripts.Render("~/bundles/jquerymobile")
In my BundleConfig.cs file, I have the following definition:
bundles.Add(new ScriptBundle("~/bundles/jquerymobile").Include("~/Scripts/jquery.mobile*"));
Essentially, I want to use the normal version when the debug="true" flag is set in my web.config compilation setting. However, when debug="false", I want to use the minified version. What am I doing wrong?
Thank you
This should happen automatically for you already (assuing the fileextensionreplacement lists still have the default "min" entry for when optimizations are enabled).
As a workaround, you could try this instead which should also work:
.Include("~/Scripts/jquery.mobile-{version}.js"));
This basically is similar to your * except it will regex match for version strings. Note, both this and what you have require that you only have the latest jquery in your Scripts folder, if you still have the 1.1 version there, you will end up with both versions in your page.

Telerik MVC controls still loading jQuery Validation even after setting it not to

I have a project I'm working on and I'm using the Telerik MVC controls. I have the newest open source version.
In my _Layout.cshtml, I have the following line:
#(Html.Telerik().ScriptRegistrar().DefaultGroup(group =>
group.Combined(false)
.Compress(false))
.jQuery(false)
.jQueryValidation(false))
I want to load jQuery and jQueryValidation myself by using Cassette. The above line keeps jQuery from loading in favor of the location and version I've specified.
My problem is that when I bring up a page with a grid on it, the jquery.validation.min.js that exists in the telerik script directory still gets loaded as well as the one I have specified from a different directory.
Why is the ScriptRegistrar still loading jQueryValidation?
There was a bug which caused this erroneous behavior. Try downloading the latest internal build.
Another approach is to replace the jquery.validation.min.js that exists in the telerik script directory with an empty file.

Resources