Chrome工作区:假设我将本地CSS文件映射到本地http服务器提供的文件.一切都很好,我可以在浏览器中修改文件,在页面刷新后我的更改仍然存在.
我们碰巧指纹我们的资产,以便通过网址引用它们styles.css?longuniquehash
.很棒的做法 - 这样我们可以使用积极的缓存,并确保客户端将使用最新的资产.
但是,这会对工作空间产生一些反作用,因为每当更新URL时映射都会丢失.简而言之:我们映射styles.css?123
到本地资源,我们更改它,并在页面刷新时返回,styles.css?234
因为必须再次映射.
我们正在使用卡带,但问题可以通过指纹识别在任何设置上重现.我缺少一个设置或解决方法吗?
css google-chrome developer-tools cassette bundling-and-minification
我正在使用Cassette,它使用Microsoft Ajax Minifier来缩小JS.此缩小器重命名变量,包括对Angular具有特殊含义的变量,例如$scope
和$http
.所以Cassette打破了我的Angular代码!
我怎样才能防止这种情况发生?
作为参考,这是正在被破坏的Angular代码.该$scope
和$http
功能参数都被重命名:
// <reference path="vendor/angular.js" />
angular.module('account-module', [])
.controller('ForgottenPasswordController', function ($scope, $http) {
$scope.email = {
value: '',
isValid: false,
containerStyle: "unvalidated",
validate: function () {
var valid = isEmailAdressValid($scope.email.value);
$scope.email.isValid = valid;
$scope.email.containerStyle = valid ? "valid" : "invalid";
return valid;
},
removeErrorMessage: function() {
$scope.email.containerStyle = "unvalidated";
}
};
$scope.display = {
formClass: '',
congratulationsClass: 'hide'
};
$scope.submit = function (event) {
event.preventDefault();
var emailValid = $scope.email.validate(); …
Run Code Online (Sandbox Code Playgroud) 我们正在为我们的mvc项目使用卡带捆绑.我们遇到了一个问题,当我们将我们的网站推送到我们的开发服务器时,某些字体文件没有进入cassette.axd.生成的样式表显示了一个指向cassette.axd中字体文件的链接,但是当我尝试拉出实际的url时,我们得到了404.所以不是要包含字体我试图看看我们是否可以从盒式磁带中排除字体文件夹缩小.结构是......
Root
|Content
|css
|styles.css
|font
Run Code Online (Sandbox Code Playgroud)
styles.css中有以下内容......
@font-face {
font-family: 'latolight_italic';
src: url('../font/lato-lightitalic-webfont.eot');
src: url('../font/lato-lightitalic-webfont.eot?#iefix') format('embedded-opentype'),
url('../font/lato-lightitalic-webfont.woff') format('woff'),
url('../font/lato-lightitalic-webfont.ttf') format('truetype'),
url('../font/lato-lightitalic-webfont.svg#latolight_italic') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'latoregular';
src: url('../font/lato-regular-webfont.eot');
src: url('../font/lato-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('../font/lato-regular-webfont.woff') format('woff'),
url('../font/lato-regular-webfont.ttf') format('truetype'),
url('../font/lato-regular-webfont.svg#latoregular') format('svg');
font-weight: normal;
font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)
在盒式磁带中产生的styles.css中,对字体的引用就像...
src:url('/ newdesign/cassette.axd/file/Content/font/lato-regular-webfont-5daaab4d79c85c0ac9f932c4848f08f673f3e6c4.eot'
有没有办法我们可以排除字体文件夹,以便css文件中的src继续指向字体文件夹而不是卡带结果?
当我试图访问data-onload时,$("#index").data("onload")
我会回来'undefined'
:
<script type="text/html">
<section id="index" data-onload="app.load()">
<div data-bind="text:name"></div>
</section>
</script>
Run Code Online (Sandbox Code Playgroud)
没有周围的脚本标记一切正常.这是使用Cassette加载的,它将其包装在脚本标记内.
我究竟做错了什么?
我们正在使用Cassette v2来合并和缩小 C# ASP.NET MVC5 项目中的 JavaScript 文件。
但是,其中一个依赖项使用 eval 按名称调用某些函数,这会在管道缩小包时导致错误。
我找到了有关 Cassette v1 的 SO 答案,但我需要配置单个捆绑包,以免在Cassette v2中缩小。
当前的配置是:
public void Configure(BundleCollection bundles)
{
bundles.Add<ScriptBundle>("~/bundles/uicomponents", new[] { "~/Scripts/bridge/UIComponents.js" })
}
Run Code Online (Sandbox Code Playgroud)
谢谢!