微信小程序使用sass编写样式转换成wxss

vscode编辑器下载EasySass插件

在这里插入图片描述

微信开发者工具导入vscode下载的EasySass插件

在这里插入图片描述
EasySass插件位置

[计算机当前用户目录]/.vscode/extensions/spook.easysass-0.0.6

修改微信开发者工具已导入的EasySass插件的package.json

点击微信开发者工具菜单的 编辑->打开编辑器扩展目录
在这里插入图片描述
修改package.json
在这里插入图片描述
改成一样的👇
在这里插入图片描述
代码复制

{
	"format": "expanded",
	"extension": ".wxss"
}

ps

添加这个插件后,要关闭微信开发者工具的自动保存,要不然修改scss文件会一直报错。创建的sass文件以.scss结尾为后缀,不要用.sass

在这里插入图片描述

我的package.json

{
	"name": "easysass",
	"displayName": "Easy Sass",
	"description": "Built-in, easy to use Sass compiler",
	"icon": "icon.png",
	"galleryBanner": {
		"theme": "light"
	},
	"repository": {
		"type": "git",
		"url": "https://github.com/wojciechsura/easysass.git"
	},
	"version": "0.0.6",
	"publisher": "spook",
	"homepage": "http://spooksoft.pl",
	"engines": {
		"vscode": "^1.10.0"
	},
	"categories": [
		"Other"
	],
	"activationEvents": [
		"*"
	],
	"main": "./extension",
	"contributes": {
		"configuration": {
			"type": "object",
			"title": "EasySass configuration",
			"properties": {
				"easysass.compileAfterSave": {
					"type": "boolean",
					"default": true,
					"description": "Automatically compile SASS/SCSS file after saving"
				},
				"easysass.formats": {
					"type": "array",
					"default": [
						{
							"format": "expanded",
							"extension": ".wxss"
						}
					],
					"description": "Define format(s) for outputted css files. Use \"nested\", \"expanded\", \"compact\" or \"compressed\" as a format."
				},
				"easysass.excludeRegex": {
					"type": "string",
					"default": "",
					"description": "Regular expression for filenames (excluding path) excluded from building. Leave empty to disable."
				},
				"easysass.targetDir": {
					"type": "string",
					"default": "",
					"description": "Target directory for generated files. If relative, will be based on currently opened folder in VS Code."
				}
			}
		},
		"commands": [
			{
				"command": "easysass.compileAll",
				"title": "Compile all SCSS/SASS files in the project"
			}
		]
	},
	"scripts": {
		"postinstall": "node ./node_modules/vscode/bin/install",
		"test": "node ./node_modules/vscode/bin/test"
	},
	"dependencies": {
		"replace-ext": "latest"
	},
	"devDependencies": {
		"typescript": "^2.0.3",
		"vscode": "^1.0.0",
		"mocha": "^2.3.3",
		"eslint": "^3.6.0",
		"@types/node": "^6.0.40",
		"@types/mocha": "^2.2.32"
	},
	"__metadata": {}
}
  • 7
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Amodoro

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值