less

Use selector name as variable in LESS mixin

喜夏-厌秋 提交于 2019-12-04 20:38:27
问题 I'm trying to create a mixin within LESS that will use it's selector name as a variable inside of the mixing. The mixin should look something like this, but I cannot find the exact syntax for it or if it's even possible: .bg{ background-image: url('images/@{SELECTORNAME}.png'); } #header{ .bg; } results in: #header{ background-image: url('images/header.png'); } I'm thinking this isn't possible, plus what would happen if the selecter was something like: div#menu ul li That wouldn't really work

Use less to generate dynamic CSS rules based on parameter value and passed mixin

允我心安 提交于 2019-12-04 19:45:34
It is possible to achieve something like this in LESS? .some-button(@className) { @className { .actionIcon; } tr:hover { @className { .actionButton; } } } When I call it: .some-button(.edit-action); The expected output should be : .edit-action { .actionIcon; } tr:hover { .edit-action { .actionButton; } } Currently I'm getting this "Unrecognized input in @className { .actionIcon; }" error: .some-button(@className) { @className { .actionIcon; } tr:hover { EDIT Another thing I would like to achieve is to use a mixin as mixin parameter: .actionButton(@buttonClassName; @buttonType) { @

Auto-generate LESS styles for sprite icons

只谈情不闲聊 提交于 2019-12-04 19:03:57
I have icon sprites image with each icon in a 20 by 20 pixel area. Each icon has several variants (black, colour, white small etc.). And have a significant amount of them. Instead of writing styles for each individual icon I'd rather just provide their names in my LESS file and let the processor generate styles for them. This is what I came up with but it doesn't seem to work. @icons: upvote,downvote,comment,new,notify,search,popup,eye,cross; @array: ~`(function(i){ return (i + "").replace(/[\[\] ]/gi, "").split(","); })("@{icons}")`; @count: ~`(function(i){ return i.split(",").length; })("@

LESS CSS background with relative path

99封情书 提交于 2019-12-04 18:43:28
问题 I'm facing with a problem when using LESS as stylesheet for my website. Personally, I'd rather use relative path in CSS than an absolute path (only my habit), but now when I use LESS with importing feature, I have a problem as the following demonstrates. I have a main.less file in root folder @import "inc/inc.less"; and a file inc.less in folder inc .homeBgr { background: url('icons/Home.gif'); } the image Home.gif is in folder /root/inc/icons - main.less - inc - inc.less - icons - Home.gif

Dynamic class names in LESS

廉价感情. 提交于 2019-12-04 18:33:22
问题 I have the following bit of LESS code working @iterations: 940; @iterations: 940; @col:2.0833333333333333333333333333333%; // helper class, will never show up in resulting css // will be called as long the index is above 0 .loopingClass (@index) when (@index > -20) { // create the actual css selector, example will result in // .myclass_30, .myclass_28, .... , .myclass_1 (~".gs@{index}") { // your resulting css width: (@index/20+1)*@col; } // next iteration .loopingClass(@index - 60); } // end

01-路由跳转 安装less this.$router.replace(path);

廉价感情. 提交于 2019-12-04 18:31:43
2==解决vue2.0里面控制台包的一些语法错误。 https://www.jianshu.com/p/5e0a1541418b 在build==>webpack.base.conf.j 下注释掉 ...(config.dev.useEslint ? [createLintingRule()] : []), rules: [ // ...(config.dev.useEslint ? [createLintingRule()] : []), { test: /\.vue$/, loader: "vue-loader", options: vueLoaderConfig }, 3==> vue使用less报错的解决方法 安装less less-loader cnpm install less less-loader --save-dev 4.1 app.vue是所有XXX.vue文件的根文件 所以webapp,的底部通常是在这里配置 4==》h5的新增 <header>标题</header> <main>主题内容</main> <footer>固定的底部内容</footer> 所以底部通常不使用footer 5==>元素在最底部水平排列 <div class="myfooterbox"> <div>外卖</div> <div>搜索</div> <div>订单</div> <div

13 复习 - webpack基本配置2

試著忘記壹切 提交于 2019-12-04 18:14:20
在webpack下使用样式表 1.安装处理样式表的loader cnpm i style-loader css-loader -D //css cnpm i less-loader less -D //less cnpm i sass-loader node-sass -D //scss 2.添加配置节点 配置文件webpack.config.js下 和plugins平级 module:{//配置所有第三方loader模块的 rules:[//第三方模块的匹配规则 {test:/\.css$/,use:['style-loader','css-loader']},//处理css文件的loader {test:/\.less$/,use:['style-loader','css-loader','less-loader']},//处理less文件的loader {test:/\.scs$/,use:['style-loader','css-loader','sass-loader']},//处理scss文件的loader ] } 来源: https://www.cnblogs.com/songsongblue/p/11876924.html

java七大排序——6_快速排序

﹥>﹥吖頭↗ 提交于 2019-12-04 18:13:29
一、快速排序: 在待排元素中找出一个基准元素,然后比较基准元素和其他元素,以基准元素为基准,将大于准的元素的放后边,小于 基准的元素放前边。然后再对分好的左右两个小区间进行快速排序 以基准元素划分区间的方式有以下2种: 第一种: 设两个参考变量less,great,less先从第一个元素开始往后遍历,直到找到的当前元素大于基准元素。 然后让great从最后一个元素开始往前遍历,直到找到当前元素小于基准元素,交换当前less和great指向的值。 再接着从less开始,重复上述动作,遍历结束的条件是less>=great; 遍历结束后,交换当前less(或great)指向的值与基准元素的值。再进行下一次的小区间内的查找 二、图示 注意:新划分的两个区间的范围是: 第一段:原本的left到上一轮基准元素最终位置的前一位;即[left,pivotIndex-1] 第二段:上一轮基准元素最终位置的后一位到原本的right;即[pivotIndex+1,right] 最终结果: 三、代码实现 public static void quickSort ( int[] array){ int left = 0; int right = array.length - 1; quickSortInternal1(array, left, right); } public static void

10 loader - 配置处理less文件的loader

六月ゝ 毕业季﹏ 提交于 2019-12-04 18:03:27
第一步:装包 cnpm i less-loader -D 安装完提示警告 peerDependencies WARNING less-loader@* requires a peer of less@^2.3.1 || ^3.0.0 but none was installed 执行以下命令安装less less是less-loader内部依赖的,并不需要显示的把less定义到webpack.config.js第三方模块加载器里面去,只要安装就行 cnpm i less -D 第二步:配置规则 module:{//这个节点,用于配置所有第三方模块加载器 rules:[//所有第三方模块的匹配规则 {test:/\.less$/,use:['style-loader','css-loader','less-loader']},//配置处理.less文件的第三方loader规则 ] } 来源: https://www.cnblogs.com/songsongblue/p/11876630.html

Using LESS mixin to set variable multiple times but getting wrong results

倖福魔咒の 提交于 2019-12-04 17:32:09
At the front, I started with less today... So any advice how to do that better is welcome! I have following .less file: .test(@target;@context) { @em: (@target / @context) * 1em; } .custom-field { position: relative; .test(30;16); padding-bottom: @em; .test(30;16); margin-bottom: @em; .test(320;16); max-width: @em; } I expect that padding-bottom and margin-bottom getting the value 1.875 and max-width: 20. But thats the output: .custom-field { position: relative; padding-bottom: 1.875em; margin-bottom: 1.875em; max-width: 1.875em; } I had the second parameter as an optional parameter at the