less

LESS CSS: Reuse generated .@{name} class as a mixin

我只是一个虾纸丫 提交于 2019-11-29 09:35:40
问题 I'm using LESS CSS 1.3.3. Sorry if this question has already been asked, I didn't find anything relevant on the web. I have several class generators that look like this (example extremely simplified, just enough to trigger the error): #genMarginTop (@name, @size) { .@{name} { margin-top: @size; } } Then I use them to generate some actual classes: #genMarginTop(mtStandard, 40px); #genMarginTop(mtHalf, 20px); So far, so good, LESS correctly generates those classes and I can use them in the HTML

Nodejs—gulp—插件合集

心已入冬 提交于 2019-11-29 08:28:13
html功能: 1.gulp-htmlmin html文件的压缩的 2.gulp-file-include 公共头部的抽取 ——注意: 在我们的html里面 需要加上 @@include(抽取的代码块的文件路径) css功能 1.gulp-csso css压缩 2.gulp-less less的转换 js功能 1.gulp-uglify js的压缩 2.gulp-babel es6转成es5 任务构建 我们可以把多个任务放在一个任务队列里面 ,然后给这个任务队列去一个名字,那我们在执行命令的时候,只需要 执行 gulp default 按照我们任务列表里面的顺序,依次去执行里面的任务 来源: https://blog.csdn.net/qq_34987378/article/details/100674263

LESS compile error ParseError: Syntax Error on line 1

本小妞迷上赌 提交于 2019-11-29 07:51:01
问题 I am trying to do some customisation on my existing bootstrap less file by importing import my own less file into existing bootstrap.less. I thought it would be simple, however I've spend painful couple hours already to try to make new less compiled. every time I add my file in I got: ParseError: Syntax Error on line 1 in C:\xxx\content\bootst rap\less\xxx.form.less:9:999 8 } My own less file: .form-unit { background-color: #F5F5F5; border-radius: 6px 6px 6px 6px; margin-bottom: 30px; padding

LESS files in Visual Studio not syntax highlighted

橙三吉。 提交于 2019-11-29 07:35:16
I have just installed Web Essentials 2012 for VS2012, but when I open a .less file, nothing is highlighted and the preview window doesn't display. Are there any settings or something I am missing to make this work? Web Essentials does not include Less tools anymore, you need to install the ASP.NET and Web Tools 2012.2 update to work with Less. A bit more details can be found on Web Essential's developer's blog. 来源: https://stackoverflow.com/questions/15323250/less-files-in-visual-studio-not-syntax-highlighted

Using class set in media query as mixin in less

落花浮王杯 提交于 2019-11-29 07:24:33
I am trying to reuse a set of classes set inside a media query as mixins to use throughout a website instead of embedding un-semantic class names in html. Here is an example of my problem. @media (min-width: 1000px) { .foo{width:120px;} .foo-2{width:150px;} } @media (max-width: 999px) { .foo{width:110px;} .foo-2{width:120px;} } .bar{.foo;} .bar-2{.foo;} .bar-3{.foo-2;} the .bar-X will never get any styles applied. I can guess that this is happening because LESS doesn't create .bar-X inside media queries, so nothing will ever be applied. Is this a bug in LESS, or something I can never achieve?

CSS @import 深入用法

时光怂恿深爱的人放手 提交于 2019-11-29 07:07:36
前端写样式使用预处理语言开发,是最有效的和方便维护 下面解释下在 less 预处理样式开发中遇到的几个问题,以便后续开发参考 1 mixin & include & extend @mixin mixin 可以声明函数 并且会返回新的样式组合,相当于样式组合工具 可以声明多个重名的 mixin函数,参数可以不同,并且在调用的时候,会根据传入的参数个数匹配调用最合适的 mixin函数 mixin 中可以使用 @if 关键字按照条件返回合适的样式 mixin 语句可以声明函数或者变量,声明函数时,可以使用when关键字 .mixin (@a) when (lightness(@a) >= 50%) { background-color: black; } mixin 可以是已有的样式,使用方式可以加()或者不加 可以给 mixin 加 !important 相当于是作用在普通样式上 @include include 相当于函数的调用,或者是变量的引用,可以使用已有样式,或者使用mixin声明的样式函数返回的样式,样式只在当前作用域生效,且不影响其他样式产出结果。 @extend 有作用域,在 @media中使用,只会作用于当前 media,使用当前media内的样式 extend 相当于给当前样式的子样式 通常用在 & 父选择器,样式,id选择器的后面,作用是扩展子类样式 2

Concatenate String in LESS in loop

拈花ヽ惹草 提交于 2019-11-29 06:59:15
I'm working on converting Unsemantic from SASS to LESS and while I'm building the loop to create my classes: .populateGridClasses (@index, @interval) when (@index > 0) { @num: @index * @interval; (~".eh-grid-@{num}, .eh-mobile-grid-@{num}, .eh-tablet-grid-@{num}") { .grid(); } .populateGridClasses(@index - 1, @interval); } .populateGridClasses (0, @interval) {} // Create the grids in an inverval of 5 .populateGridClasses(20, 5); // Create the grids in thirds .populateGridClasses(3, 33); It creates the classes as so: .eh-grid-100, .eh-mobile-grid-100, .eh-tablet-grid-100 { -webkit-box-sizing:

Enable inline javascript in LESS

人走茶凉 提交于 2019-11-29 06:18:29
问题 I would like to use inline js in my less files but I get the following message: Inline JavaScript is not enabled. Is it set in your options? How can I enable that? 回答1: I had same problem, I use webpack with less loader, I needed to add javascript option in less loader config: { test: /\.less$/, use: [{ loader: "style-loader" }, { loader: "css-loader" }, { loader: "less-loader", options: { javascriptEnabled: true } }] } I found in the sourcecode of less compiler: https://github.com/less/less

Twitter bootstrap, buttons hover style?

时间秒杀一切 提交于 2019-11-29 05:39:49
I am trying to use gradient style for my buttons, but, I have a problem with hover style, Here is the button before hover: And here is after hover: Here is haml of button: = link_to '#', {:class=>'tour_btn btn btn-large btn-primary', :style=>'margin-left: 10px; width: 105px;'} do %h3 Take a Tour LESS: .tour_btn { #gradient > .vertical(#F98C51, #a35b35); } Any idea please ? is it possible to specify another gradient style for hover state ? Or at least, not to change button when hover ? Twitter Bootstrap animates the background-position on hover with a transition (since background-gradients cant

Add syntax highlighting to .less-files in NetBeans

风格不统一 提交于 2019-11-29 05:06:22
问题 I want to have files with a .less extension use the CSS syntax highlighting in NetBeans, and I don't have any clue how to do this. I found a rather time consuming way to do this (http://netbeans.dzone.com/tips/quickstart-guide-language-supp), but it hit me that it must be easier way to do this. Anyone knows? 回答1: a module which adds full less highlighting support can be downloaded from the following page: http://plugins.netbeans.org/plugin/32782/lesscss-module i tested the module with