- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
这很好奇。我在 BundleConfig.cs 中有这些包:
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/font-awesome.css",
"~/Content/nprogress.css",
"~/Content/iCheck/flat/green.css",
"~/Content/daterangepicker.css",
"~/Content/bootstrap-dialog.css",
"~/Content/Tooltipster/css/tooltipster.css",
"~/Content/custom.css"));
bundles.Add(new ScriptBundle("~/bundles/gentelella").Include(
"~/Scripts/fastclick.js",
"~/Scripts/nprogress.js",
"~/Scripts/jquery.icheck.js",
"~/Scripts/date.js",
"~/Scripts/moment-with-locales.js",
"~/Scripts/daterangepicker.js",
"~/Scripts/validator/validator.js",
"~/Scripts/bootstrap-dialog.js",
"~/Scripts/jquery.tooltipster.js",
"~/Scripts/custom.js"));
看到我有 CSS 包和脚本包。特别查看两个包中的最后一个,custom.css 和 custom.js。
奇怪的是,在所有文件中,只有 custom.css 和 custom.js 在发布网站时没有呈现。当我调试时,一切正常。该问题仅发生在生产现场。
custom.css 和 custom.js 都没有最小化。您可以看到自定义 css here和 custom.js here .
呈现时,所有 CSS 都使用此 URL 加载:http://demo.relojelectronico.cl/Content/css?v=l7FFCONJaEcRHBZMIAQIwzM3XkNczNlgWBYwjHtrumM1
并且所有 JS 都呈现为:http://demo.relojelectronico.cl/bundles/gentelella?v=vBQcZjDbD_j0oRIktzJoqND9pbeEqe-jNtQFHZ9YfMM1
我们将不胜感激。
编辑:
我注意到 CSS 文件已正确呈现。问题仅在于 custom.js。
为了测试它,我将它分开捆绑,这样:
bundles.Add(new ScriptBundle("~/bundles/custom").Include(
"~/Scripts/custom.js"
));
这样,您可以看到捆绑版本 here .
奇怪的是,原始 JS 以以下内容开头:
/**
* Resize function without multiple trigger
*
* Usage:
* $(window).smartresize(function(){
* // code here
* });
*/
(function ($, sr) {
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced() {
var obj = this, args = arguments;
function delayed() {
if (!execAsap)
func.apply(obj, args);
timeout = null;
}
if (timeout)
clearTimeout(timeout);
else if (execAsap)
func.apply(obj, args);
timeout = setTimeout(delayed, threshold || 100);
};
};
// smartresize
jQuery.fn[sr] = function (fn) { return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
})(jQuery, 'smartresize');
/**
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
var CURRENT_URL = window.location.href.split('#')[0].split('?')[0],
$BODY = $('body'),
$MENU_TOGGLE = $('#menu_toggle'),
$SIDEBAR_MENU = $('#sidebar-menu'),
$SIDEBAR_FOOTER = $('.sidebar-footer'),
$LEFT_COL = $('.left_col'),
$RIGHT_COL = $('.right_col'),
$NAV_MENU = $('.nav_menu'),
$FOOTER = $('footer');
// Sidebar
function init_sidebar() {
// TODO: This is some kind of easy fix, maybe we can improve this
var setContentHeight = function () {
// reset height
$RIGHT_COL.css('min-height', $(window).height());
var bodyHeight = $BODY.outerHeight(),
footerHeight = $BODY.hasClass('footer_fixed') ? -10 : $FOOTER.height(),
leftColHeight = $LEFT_COL.eq(1).height() + $SIDEBAR_FOOTER.height(),
contentHeight = bodyHeight < leftColHeight ? leftColHeight : bodyHeight;
// normalize content
contentHeight -= $NAV_MENU.height() + footerHeight;
$RIGHT_COL.css('min-height', contentHeight);
$RIGHT_COL.css('height', contentHeight);
};
(我刚刚放置了它的开头)。正如您所注意到的,当创建 bundle 时,它从 init_sidebar 函数开始。 JS 文件中的许多函数也会发生同样的情况。它们在捆绑后从文件中删除。
这怎么可能?
我已经用 BundleTable.EnableOptimizations = false 进行了测试;在 BundleConfig 中,custom.js 按原样呈现。该问题仅在优化时出现。
最佳答案
如果这有助于其他面临此问题的人,我会回答我的问题。
这没有记录,但我发现了问题所在。
事实证明,在两个文件夹(Content 和 Script)中都存在 custom.css 和 custom.js 的缩小版本(名称分别为 custom.min.css 和 custom.min.js)。这些缩小版本不是custom.css和custom.js对应的缩小版本,而是原始版本。
因此,我使用了一个在线压缩器(for CSS 和 for JS)并替换了该网站的最小版本,并且成功了。
这是结论。在 ASP.NET MVC 中启用优化后,优化器首先查找等效的“.min”。如果文件存在于文件夹中。如果是,则将该文件发送到浏览器。如果没有,它会执行缩小。
这也可能是“.min.”的原因。文件的版本被添加到 bundle 中,它不起作用并且根本没有发送文件。
也许所有这些都记录在某处,但我没有找到。
干杯,
杰米
关于css - MVC5 bundle 不适用于某些资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45045907/
有人告诉我,如果我只有一个“东西”,比如家(不是多个家),我应该在 routes.rb 中使用资源 :home,而不是资源 :home。但是当我查看路由时,POST 函数似乎想要 home#creat
Activity 开始。这些代码框架顺利通过。 // Initialize array adapters. One for already paired devices and //
资源 search-hadoop.com search-hadoop.com索引所有邮件列表,非常适合历史搜索。当你遇到问题时首先在这里搜索,因为很可能有人已经遇到了你的问题。 邮件列表 在A
我是 WPF 的新手,正在努力使用位于单独程序集中的样式。这就是我正在做的:- 我有一个带有\Themes 文件夹的类库项目,其中包含一个“generic.xaml”,它合并了\Themes 内的子文
我正在编写一个使用虚拟树状文件结构的插件。基本上它就像一个包含文件的标准文件系统,区别在于这些文件实际上并不存在于文件系统中的特定位置,而只是 java 对象。 这些当前由使用 SettingProv
如果我在 XAML 中使用以下内容,我会收到错误消息: 错
我正在使用 laravel 资源来获取 api 的数据: return [ 'id' => $this->id, 'unread' =>
我有以下 pom.xml: 4.0.0 mycompany resource-fail 0.0.1-SNAPSHOT BazBat
许多GDI +类都实现IDisposable,但是我不确定何时应该调用Dispose。对于使用new或静态方法(例如Graphics.CreateGraphics)创建的实例来说,这很明显。但是,由属
我正在构建一组 RESTful 资源,其工作方式如下:(我将使用“people”作为示例): 获取/people/{key} - 返回一个人对象 (JSON) GET/people?first_nam
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为
我有一个使用 $resource 的简单 Controller : var Regions = $resource('mocks/regions.json'); $scope.regions =
在 Azure 门户中,如何查看不同资源之间的依赖关系。我特别想查看哪些资源正在使用我要删除的存储。 最佳答案 您可以使用应用程序洞察应用程序 map 来执行此操作: 您还可以打开存储帐户的日志记录:
我正在使用 ionic 生成资源(图标和启动画面)。我正在使用 ionic v2.1.0 和 cordova v6.4.0。 到目前为止我一直在使用(它在以前的版本中工作): cordova plat
是否可以使用 Assets 包含子文件夹中的文件? 示例:[base_url]/assets/css/pepper-grinder/jquery-ui-1.8.11.custom.min.css 最佳
我正在阅读一些尝试教授 Android 开发的书。在书中,作者概述了 res/下的一些目录。他提到 res/menu 包含基于 XML 的菜单规范。他还提到了保存“通用文件”的 res/raw。当我创
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 9 年前。 Improv
我在服务器上使用 express-resource。在我的 AngularJS Controller 中: var User = $resource('/services/users/:use
因此,每当我运行我的应用程序时,它都会立即崩溃并给出以下错误: No package identifier when getting value for resource number 0x00000
对于我正在创建的(网络)应用程序,我需要使用基本身份验证在我的 UIWebView 中加载页面。 现在设置我使用的授权 header : NSString *result = [NSString st
我是一名优秀的程序员,十分优秀!