Squishit.Less什么也没做 [英] Squishit.Less doesn't do anything

查看:85
本文介绍了Squishit.Less什么也没做的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用软件包管理器来安装Squishit.Less 0.9.3,并且我有两个文件

I've used package manager to install Squishit.Less 0.9.3, and I have two files

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

在我的页面中,我有:

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

但是我得到的输出是:@import"test.less";-较少的处理器由于某种原因未尝试获取导入?

But the output I get is: @import"test.less"; - the less processor hasn't tried to get the import for some reason?

我已经尝试过ProcessImports,但这没什么区别.

I've tried ProcessImports but that made no difference.

推荐答案

我刚刚在示例项目中验证了它可以正常工作.

I just verified in a sample project that it works correctly.

您不需要调用ProcessImports-较少的预处理程序应自动执行此操作. ProcessImports适用于标准CSS中的@imports,默认情况下不会对其进行处理.

You should NOT need to call ProcessImports - the less preprocessor should do this automatically. ProcessImports is for @imports in standard CSS, which aren't processed by default.

我怀疑发生的事情是NuGet没有添加注册预处理器的文件.结果,永远不会调用较少的预处理器.如果在App_Start下查看,应该会看到一个名为SquishItLess.cs的文件,其内容如下:

I suspect what happened is that NuGet didn't add the file that registers the preprocessor. 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:

[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());
        }
    }
}

如果缺少此文件,则可以添加它,也可以在Global.asax.cs的Application_Start方法中添加Bundle.RegisterStylePreprocessor行.

If this file is missing, you can either add it or add the Bundle.RegisterStylePreprocessor line in your Global.asax.cs' Application_Start method.

如果您要安装到VB项目,则这是一个已知问题( https://github .com/jetheredge/SquishIt/issues/232 ),并且在.net 3.5支持下拔出插头后即可解决.

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.

这篇关于Squishit.Less什么也没做的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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