From 8b3499f8aa3e1ab9a6be12f874ae96afe98daab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Wed, 4 Aug 2021 17:44:33 +0800 Subject: [PATCH] fixed include paths --- index.js | 21 +++++++++++---------- package.json | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index 452b894..4e6fc8d 100644 --- a/index.js +++ b/index.js @@ -11,9 +11,17 @@ const scss = require('sass') const fs = require('iofs') const postcss = require('postcss') const autoprefixer = require('autoprefixer') -let prefixer const std = vsc.window.createOutputChannel('scss-to-css') + +let prefixer +let options = { + compileOnSave: true, + autoPrefixer: true, + output: 'compressed', + exclude: '' +} + std.out = function(msg) { std.appendLine(msg) } @@ -21,26 +29,19 @@ std.out = function(msg) { // 编译scss function render(style, file) { try { - let data = fs.cat(file).toString() return ( scss.renderSync({ - data, + file, outputStyle: style }).css + '' ).trim() } catch (err) { std.out(err) + std.show(true) // console.error(err) } } -let options = { - compileOnSave: true, - autoPrefixer: true, - output: 'compressed', - exclude: '' -} - const compileScss = (style, entry, output) => { if (options.outdir) { let tmp = output.replace(options.workspace, '.') diff --git a/package.json b/package.json index e869fa6..a92169c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "scss-to-css", "displayName": "scss-to-css", "description": "🔥 The easiest way to compile scss file to css. And autoprefixer at the same time.", - "version": "3.1.0", + "version": "3.1.1", "publisher": "yutent", "author": "Yutent [@yutent]", "icon": "logo.png",