less

@viewport, @media and LESS

喜欢而已 提交于 2019-12-05 10:45:24
I've recently converted some CSS to LESS for use with a .NET application (I am using dotless for .NET, http://www.dotlesscss.org/ to compile the LESS at runtime). The compiler is falling down on these two blocks of code: @viewport { width: device-width; } /* Add a min-width for IE 8 and lower */ @media \0screen\,screen\9 { body { min-width: 960px; } } Just for your reference, the media query above is a hacky way of targeting IE How can I "LESS-ify" these blocks of code? Martin Turjak In Less >= 1.4.0 you can simply define a variable and use it in the media query: @iehack: \0screen\,screen\9;

How to autoprefix css files generated by less, in Webstorm?

拥有回忆 提交于 2019-12-05 10:44:34
I've got Webstorm 7 (on Win7) compiling my .less files into minified css with sourcemaps (using lessc on nodejs v0.10.26, run from a File Watcher in Webstorm), and I can then run autoprefixer on that generated css to automatically insert vendor prefixes. What I'm not sure how to do, is combine the two steps. Is it possible to chain File Watchers in Webstorm? Possible approaches: Create a batch script that is called from the file watcher, then calls less and autoprefixer in sequence. Create a node.js script/module that calls less, then autoprefixer. Have the less transpiler output the css with

less.js - get variable values inside parsers' callback

冷暖自知 提交于 2019-12-05 10:36:55
I am using less.js (1.3.0) to parse less to css on the client side. Inside the parsers' callback I want to get the value for each variable. i tried the following without success. var data = "@colour: red; #example { background-color: @colour; }", parser = new less.Parser({}); parser.parse(data, function (error, root) { console.log( root.toCSS() ); var varsDef = root.variables(); for (k in varsDef) { console.log(varsDef[k]); // how to get the value for the var? //not working console.log(varsDef[k].eval()); //not working console.log(varsDef[k].toCSS()); //is an object but looking for a string

Passing less variables from webpack

别说谁变了你拦得住时间么 提交于 2019-12-05 10:29:14
I'm trying to pass less variables within a webpack configuration to the less loader, naturally. For some reason the variable is not being passed ok. I can't figure the correct syntax. The variable has a dynamic content that is determined at the build time, in the webpack config file. This is the relevant line (I've tried many variations of it): loader: 'style!css?-minimize!less?-minimize&{modifyVars:{"resources-path-prefix":"' + pathPrefix + '"}}' In the above example some pathPrefix is being determined at build time and we want to pass its value into less context, where it will be used in url

使用gulp编译es6 , less 代码

我与影子孤独终老i 提交于 2019-12-05 10:27:19
传统的js代码是不支持箭头函数 和 es6的继承特性的 写个类 , 继承还要写个闭包 , call , prototype。。菜鸟的我 表示挺麻烦的 挺麻烦的 这个只是把幕课网上配置的视频简化成文字 , 下次使用的时候不用再次打开视频 1.新建项目文件 src src目录下新建 css js less gulpfile.js webpack.config.js文件 www目录下新建css js index.html文件 2.初始化项目 npm init , 安装依赖 cnpm install babel-core babel-loader babel-present-es2015 gulp gulp-less gulp-util webpack-stream --save-dev 3.编写gulp编译的配置文件 , const gulp = require("gulp"); const webpack = require('webpack-stream'); gulp.task('webpack' , () => { //转译javascript //webpack 配置 const config = require('./webpack.config.js'); gulp.src('./js/**/*.js') .pipe(webpack(config)) .pipe(gulp

Less-学习笔记

旧街凉风 提交于 2019-12-05 10:26:25
这是less官网的介绍: http://www.1024i.com/demo/less/document.html 大家都是在一起学习,最好的地方无疑就是官网,不过每个人学习方式和基础不同,以至于学完后掌握才会出现差异 开源中国提供了好的直接编译器: http://tool.oschina.net/less 接下来就开始学习和了解less的使用和优势。 一.@:变量的使用 1.原生css的一些不方便 我们先看我们经常写的css: .aa{ height:200px; background:#066;} .bb{ height:200px; background:#066;} .dd{ height:200px; color:#066;width:100px;} 我们发现,高度取值相同我们却要写3次,颜色取值也是要写多次,这时候如果css像语言一样,可以定义一个变量,这里面存放公用取值,假如能如下方式实现: var hei1="200px"; var cor1="#066"; .aa{ height:hei1; background:cor1;} .bb{ height:hei1; background:cor1;} .dd{ height:hei1; color:cor1;width:100px;} 这样我们就会非常的方便,在书写css的时候同样取值应用变量就ok了。 2

Use Node.js as standalone LESS-compiler in project?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 10:24:56
I've been trying to incorporate the lessc compiler in a large project that has the basic setup from Bootstrap and it only results in various compileerrors (for which there are tickets for everyone with different solutions). Not one solution give me what I want, which is a way to compile the less-pile through the command line. I compile various other assets through node.js and hoped to do the same thing with the less, but every googlepage I find on the subject is Node.js+Express which is not what I want. I want a standalone compiler. (Idea: require.js r.js-file) I found Node-less but it hasnt

Rounded corner tables with LESS

狂风中的少年 提交于 2019-12-05 09:35:02
After some digging around on SO I found this as the best response for my need of having rounded corners for tables. Which lead me to the following CSS snippet: .greytable tr:first-child th:first-child { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; } .greytable tr:first-child th:last-child { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; } .greytable tr:last-child td:first-child { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px;

LESS linear gradient mixin

痴心易碎 提交于 2019-12-05 09:03:28
问题 I use a mixin for linear-gradient like this: .linear-gradient (@color1:#ccc, @color2:#fff, @stop1:0, @stop2:100%, @dir:top) { background-color: @color2; background: -webkit-linear-gradient(@dir, @color1 @stop1, @color2 @stop2); background: -moz-linear-gradient(@dir, @color1 @stop1, @color2 @stop2); background: -ms-linear-gradient(@dir, @color1 @stop1, @color2 @stop2); background: -o-linear-gradient(@dir, @color1 @stop1, @color2 @stop2); background: linear-gradient(@dir, @color1 @stop1,

sass+less相关

时间秒杀一切 提交于 2019-12-05 08:59:58
sass入门-sass教程 http://www.w3cplus.com/sassguide/ CanvasRenderingContext2D https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D Photoshop CC 与前端那些事 http://isux.tencent.com/ps-photoshop-cc-fd.html Less 中文网 http://lesscss.cn/ 快速入门 | Less.js 中文文档 http://less.bootcss.com/ LESS 一种动态样式语言 http://www.bootcss.com/p/lesscss/ Less 学习手册 http://www.1024i.com/demo/less/ z.less api http://www.aibusy.com/zless/ 来源: https://www.cnblogs.com/home-/p/11917722.html