less

RegEx not working for long pattern PCRE's JIT compiler stack limit - PHP7

微笑、不失礼 提交于 2019-12-17 20:53:39
问题 I am using oyejorge's less compiler. list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); traps an Exception. I narrowed it down, and I created a test script $regex = '/\\G"((?:[^"\\\\\r\n]|\\\\.|\\\\\r\n|\\\\[\n\r\f])*)"|\'((?:[^\'\\\\\r\n]|\\\\.|\\\\\r\n|\\\\[\n\r\f])*)\'/'; $image = '"data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc

How to show the compiled css from a .less file in the browser?

霸气de小男生 提交于 2019-12-17 20:39:02
问题 What is the best way to show the resulting css from files compiled with less.js in the client. In other words, how can i fill a div with the resulting css? I need to display the result on the page, any way to do this? THanks! 回答1: update As already pointed out in the comments by @ertrzyiks you should replace less.parse with less.render for Less v 2.x: var lessCode = ''; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function(){ if(xmlhttp.status == 200 && xmlhttp.readyState

ANT script to compile all (css) LESS files in a dir and subdirs with RHINO

淺唱寂寞╮ 提交于 2019-12-17 15:44:59
问题 I want do compile all *.less scripts in a specific folder and it subdirs with less-rhino-1.1.3.js . There is an example on github for doing this for a specific file, which works perfect. But I want to do the same for a complete folder. I tried a lot, here is my last try. It doesn't work, propertyregex seems not to be standard ANT, I don't want to use such things. I am not even sure if this code would work. <project name="test" default="main" basedir="../../"> <property name="css.dir" location

How to re-use a mixin whose selector is formed using concatenation

蓝咒 提交于 2019-12-17 14:18:52
问题 In Less, I can write: .outer { .inner { color: red; } } .test { .outer .inner; } But when I write: .outer { &-inner { color: red; } } .test { .outer-inner; } When I remove the .test , the .outer-inner output properly, but when I add it back, the compiler says .outer-inner is undefined. Is there anyway to re-use the styles of .outer-inner ? 回答1: Calling a mixin whose selector is formed by concatenation is currently not possible with Less. However the same is possible for selectors formed at

Conditionally setting one variable's value based on another

混江龙づ霸主 提交于 2019-12-17 13:58:29
问题 I've got a Less variable called @side . What I want is to set the variable @sideOpposite depending on the value of the @side variable. It can take only two values: "left" or "right". In other words I need a Less equivalent of the JS code: var side = "left", sideOpposite = (side === "left")? "right" : "left"; I've tried to accomplish this using when function, but from what I understand it doesn't work that way and is only applicable to CSS properties, not variables: when (@side = right){

Slashes (`/`) in CSS values when using Less (e.g. in `font` shorthand)

依然范特西╮ 提交于 2019-12-17 10:49:16
问题 i noticed an issue when using Less with font shorthand .font(@weight: 300, @size: 22px, @height: 32px) { font: @weight @size/@height "Helvetica Neue", Arial, "Liberation Sans", FreeSans, sans-serif; } the above fails with this.a.toCSS is not a function http://localhost/tumblr/modern1/css/style.less on line 1, column 0: 1. @highlight: #cb1e16; 2. @shade1: #cb1e16; when i split the properties up it works .font(@weight: 300, @size: 22px, @height: 32px) { font-weight: @weight; font-size: @size;

LESS CSS: abusing the & Operator when nesting?

泄露秘密 提交于 2019-12-17 07:39:35
问题 Less uses the & Operator to enhance the possibilities for nesting. .header { color: black; .navigation { font-size: 12px; &.class { text-decoration: none } } } which causes a substitution of the & with the parent selector and results in a concatentation of the actual selector right to the parent selector: .header .navigation.class instead of the normal appending, which would result in .class being a decendant: .header .navigation .class . Now what also is possible is the following (see also

css3中单位rem与.less结合布局

心已入冬 提交于 2019-12-17 07:04:17
rem是CSS3新增的一个相对单位(root em,根em),这个单位引起了广泛关注。这个单位与em有什么区别呢?区别在于使用rem为元素设定字体大小时,仍然是相对大小,但相对的只是HTML根元素。 通常的,我们把html的font-size设置成0.625%;因为浏览器默认的字体大小是16px,所以font-size:0.625也就相当于16px*0.625=10px;往后我们要设置字体大小的时候,就可以用rem了. 例如font-size:1.2rem; 就相当于 font-size:12px;了 但可能有一些浏览器的默认字体不是16px.所以我们可以直接把html的font-size设置成10px;就可以确保万无一失. 然后还有个问题,谷歌浏览器的最小文字大小为12px;假如把rem用到宽高,行高,边距的时候,html设定的10px并不起作用.会默认按照12px来计算.因此最好我们只把rem用到字体大小上. 通常的,我们的wap端页面设计稿的宽度为640px或者750px;我们想要按照设计稿的样子,尽可能不变形地适应各种宽度的显示屏.我们就需要字体大小宽高等全都用rem. 这时候,我们可以使用less来进行计算.在不同的浏览器宽度时,给html赋予不同的默认字体大小,且字体大小与屏幕宽度的比例是一样的.如下: (为了配合谷歌浏览器最小字体为12px

How to use bootstrap with 16 or 24 columns

ε祈祈猫儿з 提交于 2019-12-17 06:36:24
问题 I need some help setting bootstrap 2.0.4 to be 16 or 24 column instead of the default 12 columns i can't understand what am i doing wrong i tried the customize option on the bootstrap site and i tried changing the grid variables in the variables.less file and recompile bootstrap.less using Crunch but for both trials i still have the same result .it is still 12 columns !!! when i try to set a div to be span12 it still takes the whole screen ? Can anyone guide me to what's wrong i am doing or

Disable LESS-CSS Overwriting calc() [duplicate]

大兔子大兔子 提交于 2019-12-17 01:33:51
问题 This question already has answers here : Less aggressive compilation with CSS3 calc (4 answers) Closed 3 years ago . Right Now I'm trying to do this in CSS3 in my LESS code: width: calc(100% - 200px); However, when LESS compiles it is outputting this: width: calc(-100%); Is there a way to tell LESS not to compile it in that manner and to output it normally? 回答1: Using an escaped string (a.k.a. escaped value): width: ~"calc(100% - 200px)"; Also, in case you need to mix Less math with escaped