如何将变量从PHP传递给LESS? [英] How to pass a variable from PHP to LESS?

查看:64
本文介绍了如何将变量从PHP传递给LESS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用PHP(lessphp)在服务器端将LESS文件编译为CSS文件.我想将一个变量传递给LESS文件,例如颜色或语言:

I use PHP (lessphp) to compile LESS files into CSS files on the serverside. I would like to pass a variable to the LESS file, like a color or a language:

compile('input.less?lang=en')

并将其用作像@lang这样的LESS中的变量.

and use it as a variable in LESS like @lang.

这可能吗?如果没有,是否有任何解决方法?

Is this possible? If not, are there any workarounds?

推荐答案

这是 lessphp 的内置功能,这里是文档: http://leafo.net/lessphp/docs/#setting_variables_from_php

This is a built in feature of lessphp, here's the documentation: http://leafo.net/lessphp/docs/#setting_variables_from_php

这篇关于如何将变量从PHP传递给LESS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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