fixed include paths

master
宇天 2021-08-04 17:44:33 +08:00
parent ddd1302199
commit 8b3499f8aa
2 changed files with 12 additions and 11 deletions

View File

@ -11,9 +11,17 @@ const scss = require('sass')
const fs = require('iofs') const fs = require('iofs')
const postcss = require('postcss') const postcss = require('postcss')
const autoprefixer = require('autoprefixer') const autoprefixer = require('autoprefixer')
let prefixer
const std = vsc.window.createOutputChannel('scss-to-css') const std = vsc.window.createOutputChannel('scss-to-css')
let prefixer
let options = {
compileOnSave: true,
autoPrefixer: true,
output: 'compressed',
exclude: ''
}
std.out = function(msg) { std.out = function(msg) {
std.appendLine(msg) std.appendLine(msg)
} }
@ -21,26 +29,19 @@ std.out = function(msg) {
// 编译scss // 编译scss
function render(style, file) { function render(style, file) {
try { try {
let data = fs.cat(file).toString()
return ( return (
scss.renderSync({ scss.renderSync({
data, file,
outputStyle: style outputStyle: style
}).css + '' }).css + ''
).trim() ).trim()
} catch (err) { } catch (err) {
std.out(err) std.out(err)
std.show(true)
// console.error(err) // console.error(err)
} }
} }
let options = {
compileOnSave: true,
autoPrefixer: true,
output: 'compressed',
exclude: ''
}
const compileScss = (style, entry, output) => { const compileScss = (style, entry, output) => {
if (options.outdir) { if (options.outdir) {
let tmp = output.replace(options.workspace, '.') let tmp = output.replace(options.workspace, '.')

View File

@ -2,7 +2,7 @@
"name": "scss-to-css", "name": "scss-to-css",
"displayName": "scss-to-css", "displayName": "scss-to-css",
"description": "🔥 The easiest way to compile scss file to css. And autoprefixer at the same time.", "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", "publisher": "yutent",
"author": "Yutent [@yutent]", "author": "Yutent [@yutent]",
"icon": "logo.png", "icon": "logo.png",