简体   繁体   English

Squishit.Less什么都不做

[英]Squishit.Less doesn't do anything

I've used package manager to install Squishit.Less 0.9.3, and I have two files 我已经使用包管理器来安装Squishit.Less 0.9.3,我有两个文件

  1. style.less - @import "test.less"; style.less - @import "test.less";
  2. test.less - body{background-color: pink;} . test.less - body{background-color: pink;}

In my page I have: 在我的页面中,我有:

<%= Bundle.Css().Add("~/less/style.less").ForceRelease().Render("~/less/combined.css") %>

But the output I get is: @import"test.less"; 但我得到的输出是: @import"test.less"; - the less processor hasn't tried to get the import for some reason? - 由于某些原因,较少的处理器没有尝试获取导入?

I've tried ProcessImports but that made no difference. 我尝试过ProcessImports但没有任何区别。

I just verified in a sample project that it works correctly. 我刚刚在示例项目中验证了它是否正常工作。

You should NOT need to call ProcessImports - the less preprocessor should do this automatically. 您不应该需要调用ProcessImports - 较少的预处理器应该自动执行此操作。 ProcessImports is for @imports in standard CSS, which aren't processed by default. ProcessImports用于标准CSS中的@imports,默认情况下不处理。

I suspect what happened is that NuGet didn't add the file that registers the preprocessor. 我怀疑发生了什么是NuGet没有添加注册预处理器的文件。 As a result the less preprocessor is never called. 因此,从不调用较少的预处理器。 If you look under App_Start you should see a file called SquishItLess.cs with the following contents: 如果您在App_Start下查看,您应该看到一个名为SquishItLess.cs的文件,其中包含以下内容:

[assembly: WebActivator.PreApplicationStartMethod(typeof(MyProject.App_Start.SquishItLess), "Start")]

namespace MyProject.App_Start
{
    using SquishIt.Framework;
    using SquishIt.Less;

    public class SquishItLess
    {
        public static void Start()
        {
            Bundle.RegisterStylePreprocessor(new LessPreprocessor());
        }
    }
}

If this file is missing, you can either add it or add the Bundle.RegisterStylePreprocessor line in your Global.asax.cs' Application_Start method. 如果缺少此文件,您可以在Global.asax.cs的Application_Start方法中添加或添加Bundle.RegisterStylePreprocessor行。

If you're installing to a VB project this is a known issue ( https://github.com/jetheredge/SquishIt/issues/232 ) and will be addressed when the plug is pulled on .net 3.5 support. 如果您正在安装VB项目,这是一个已知问题( https://github.com/jetheredge/SquishIt/issues/232 ),当插件被拔出.net 3.5支持时将解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM