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",