admin管理员组文章数量:1406349
Background: I am migrating an ASP.NET
MVC 5
application (developed in Windows 8.1, VS2013
Community, .NET 4.5.1
, MySql
custom membership and role provider) project to Monodevelop
(in Ubuntu 14.4
, Monodevelop
, Mono
).
In my ~/App_Start/BundleConfig
class
public static void RegisterBundles(BundleCollection bundles)
{
BundleTable.EnableOptimizations = true;
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
}
In my ~/Views/Shared/_Layout.cshtml
view
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
In my Web.Config
<add namespace="System.Web.Optimization" />
Also
<pilation defaultLanguage="C#" debug="false"> </pilation>
Also Microsoft.Web.Infrastructure.dll
is deleted from the bin directory.
Problem: I don't see that the bundles are getting rendered when I view source in the browser:
The links are directing towards directories, It should show files in the directories
<link href="/Content/css" rel="stylesheet"/>
<script src="/bundles/modernizr"></script>
This bundling is working very fine on Windows but on Ubuntu, I see only directories
What am I doing wrong here?
Background: I am migrating an ASP.NET
MVC 5
application (developed in Windows 8.1, VS2013
Community, .NET 4.5.1
, MySql
custom membership and role provider) project to Monodevelop
(in Ubuntu 14.4
, Monodevelop
, Mono
).
In my ~/App_Start/BundleConfig
class
public static void RegisterBundles(BundleCollection bundles)
{
BundleTable.EnableOptimizations = true;
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
}
In my ~/Views/Shared/_Layout.cshtml
view
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
In my Web.Config
<add namespace="System.Web.Optimization" />
Also
<pilation defaultLanguage="C#" debug="false"> </pilation>
Also Microsoft.Web.Infrastructure.dll
is deleted from the bin directory.
Problem: I don't see that the bundles are getting rendered when I view source in the browser:
The links are directing towards directories, It should show files in the directories
<link href="/Content/css" rel="stylesheet"/>
<script src="/bundles/modernizr"></script>
This bundling is working very fine on Windows but on Ubuntu, I see only directories
What am I doing wrong here?
Share Improve this question edited Jan 13, 2016 at 17:07 Mr.X asked May 28, 2015 at 6:15 Mr.XMr.X 31.4k27 gold badges147 silver badges229 bronze badges 6-
3
Are you debugging and have
<pilation debug="true" />
orBundleTable.EnableOptimizations = false;
? – rageit Commented Jun 17, 2015 at 11:14 -
@rageit - I am debugging and not able to see
BundleTable.EnableOptimizations
in my project. Is it something in web.config or BundleConfig? If yes how can I use it? – Mr.X Commented Jun 22, 2015 at 7:18 -
1
Do you have a
Microsoft.Web.Infrastructure.dll
in yourbin
directory? If so, try deleting it. Mono has it's own implementation it will use if this file is missing. – Dave Alperovich Commented Jul 15, 2015 at 20:16 - When optimization is turned off, is it including the individual files from the bundle? If not, then it's probably not finding the files for the bundle. If it does, then something is preventing the bundler from intercepting the route for the bundle's path when you have optimization turned on.. – Benjamin Anderson Commented Jul 22, 2015 at 15:52
- @BenjaminAnderson - are you talking about Ubuntu or Windows? On Windows there is no issue. – Mr.X Commented Jul 22, 2015 at 15:55
2 Answers
Reset to default 6 +50Inside your BundleConfig file add the following:
BundleTable.EnableOptimizations = true;
Then switch to release mode.
This should do the trick
I just came across this issue myself today. Mihai-Tibrea 's answer does indeed work, but it leads to unacceptable requirements for my purposes.
If always enabling bundling (BundleTable.EnableOptimizations = true; and/or build in release mode) is not acceptable consider the following:
In BundleConfig.cs find a line like this:
"~/Content/site.css"
Change that to
"~/Content/Site.css"
Note that in mono, the case of file names is very important, while that is not important in windows. So either your html needs to use lower-case site.css OR your bundle needs to start with a capital letter.
本文标签: javascriptStylesheets and scripts bundles not working in MonoStack Overflow
版权声明:本文标题:javascript - Stylesheets and scripts bundles not working in Mono - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745003111a2637100.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论