我们首先需要在vscode中安装easyLess插件
操作如下:
easy Less的配置
{
"less.compile": {
"compress": true, // true => remove surplus whitespace
"sourceMap": false, // true => generate source maps (.css.map files)
// "out": "../css/", // false => DON'T output .css files (overridable per-file, see below)
"outExt": "wxss" //这是我们微信小程序需要配置的
},
"files.autoSave": "off",
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"window.zoomLevel": 1,
"window.menuBarVisibility": "toggle",
"[json]": {
"editor.defaultFormatter": "lonefy.vscode-JS-CSS-HTML-formatter"
},
"[javascript]": {
"editor.defaultFormatter": "lonefy.vscode-JS-CSS-HTML-formatter"
}
}
如果不是做小程序项目,我们可以使用"out": "../css/"
,作用是可以把less转为css文件
如果是做小程序项目,就把"out": "../css/"
改成"outExt": "wxss"
就可以了
操作如下图所示:
网友评论