缩小失败。返回unminified内容 [英] Minification failed. Returning unminified contents

查看:1548
本文介绍了缩小失败。返回unminified内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经作出了使用MVC 5第一的网站,我的本地机器工作正常,但当我把它发布到服务器的某些CSS不正确加载。

I have made my first website using MVC 5 which works fine on my local machine but when I publish it to the server some of the css not loading correctly.

/* Minification failed. Returning unminified contents.
(80,1): run-time error CSS1019: Unexpected token, found '@import'
(80,9): run-time error CSS1019: Unexpected token, found 'url('../Content/dark-skin/skin.css')'
(671,16): run-time error CSS1062: Expected semicolon or closing curly-brace, found ':'
(1288,16): run-time error CSS1062: Expected semicolon or closing curly-brace, found ':'
(1680,1): run-time error CSS1019: Unexpected token, found '@keyframes'
(1682,5): run-time error CSS1062: Expected semicolon or closing curly-brace, found '50%'
(1685,1): run-time error CSS1019: Unexpected token, found '@-webkit-keyframes'
(1687,5): run-time error CSS1062: Expected semicolon or closing curly-brace, found '50%'
 */
/* NUGET: BEGIN LICENSE TEXT
 *
 * Microsoft grants you the right to use these script files for the sole
 * purpose of either: (i) interacting through your browser with the Microsoft
 * website or online service, subject to the applicable licensing or use
 * terms; or (ii) using the files as included with a Microsoft product subject
 * to that product's license terms. Microsoft reserves all other rights to the
 * files not expressly granted by Microsoft, whether by implication, estoppel
 * or otherwise. The notices and licenses below are for informational purposes only.
 *
 * NUGET: END LICENSE TEXT */
/*!
 * Bootstrap v3.0.0
 *
 * Copyright 2013 Twitter, Inc
 * Licensed under the Apache License v2.0
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Designed and built with all the love in the world by @mdo and @fat.
 *//*! normalize.css v2.1.0 | MIT License | git.io/normalize */

据我所知,编译器试图最小化css文件,但不这样做。我试图纠正这些错误,但纠正其中的一些出版后再次出错看起来是一样的,如不接我的变化。

I understand that compiler is trying to minimize the css files but is failing to do so. I tried to correct those errors but after correcting some of them and publishing again the error looks the same, like is not picking my changes.

即使奇怪的事是与我稍微修改了该网站的目的bootstrap.css文件。当我发布它的变化并不在包文件。是否有可能引导从引导服务器的广告不是我装的项目?

Even strangest thing is with the bootstrap.css file which I have slightly modified for the purpose of the website. When I publish it the changes are not in the bundle file. Is it possible that bootstrap is loaded from Bootstrap server ad not my project?

bundles.Add(new StyleBundle("~/Content/cssmain").Include(
                  "~/Content/bootstrap.css",
                  "~/Content/site.css",
                  "~/Content/ilightbox.css",
                  "~/Content/bannerscollection_zoominout.css"));

我也试图做使用Web应用程序的缩小自己,但我的变化是不可见的,这些文件看起来不minificated。

I have also tried to do minification myself using web application but my changes are not visible and the files looks not minificated.

任何帮助是pciated AP $ P $

Any help is appreciated

推荐答案

我决定做两件事情捆绑bootstrap.css问题:

I resolved the problem bundling bootstrap.css by doing 2 things:


  1. 包括被捆绑的bootstrap.css 第一。在这个问题的code样品已经这样做了,但我没有。

  2. 缩小的官方版本(bootstrap.min.css)添加到项目中的同一目录中unminified版本。这提示用户使用,而不是试图(和失败)来缩小bootstrap.css本身已有缩小的文件打捆。请参阅下面的截图中的绿色箭头。

  1. Include the bootstrap.css first in the bundle. The code sample in the question already does this, but I was not.
  2. Add the official minified version (bootstrap.min.css) to the project in the same directory as the unminified version. This prompts the bundler to use the existing minified file instead of trying (and failing) to minify bootstrap.css itself. See the green arrow in the screenshot below.

请注意,如果你正在使用一个特定的主题,替代bootstrap.css和bootstrap.min.css由主题所提供的文件。下面是我的项目工作code使用的空间实验室的主题是:

Note that if you are using a specific theme, substitute bootstrap.css and bootstrap.min.css with the files provided by the theme. Here's the working code from my project that uses the spacelab theme:

            bundles.Add(new StyleBundle(GetStyleBundlePath("bootstrap")).Include(
            "~/Content/3rdParty/bootstrap.spacelab.css",
            "~/Content/3rdParty/bootstrap-datepicker.css",
            "~/Content/3rdParty/bootstrap-multiselect.css"));

这篇关于缩小失败。返回unminified内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆