修复autoprefixer的配置

pull/19/head
宇天 2018-12-03 14:08:33 +08:00
parent 9c97ded959
commit 9563e8adbe
5 changed files with 964 additions and 129 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@
# Files that might appear on external disk
.Spotlight-V100
.Trashes
package-lock.json
node_modules
*.vsix

View File

@ -1,3 +1,4 @@
.vscode/**
package-lock.json
.gitignore

View File

@ -14,10 +14,10 @@ const fs = require('iofs')
const scss = require('node-sass')
const postcss = require('postcss')
const autoprefixer = require('autoprefixer')
const prefixer = postcss().use(autoprefixer())
let prefixer
const std = vsc.window.createOutputChannel('scss-to-css')
std.out = function() {
std.out = function(msg) {
std.appendLine(msg)
}
const log = function(...args) {
@ -109,7 +109,7 @@ const Compiler = {
})
})
.catch(err => {
log(err)
std.out(err)
})
},
@ -143,12 +143,36 @@ const Compiler = {
}
function activate(ctx) {
// log('hello, the extend scss-compiler is running....')
// log('hello, the extend scss--to-css is running....')
let folders = vsc.workspace.workspaceFolders
let wsf = ''
let browsersrc = ''
if (folders && folders.length) {
wsf = folders[0].uri.path
}
if (wsf) {
browsersrc = path.join(wsf, '.browserslistrc')
}
if (fs.exists(browsersrc)) {
options.browsers = fs
.cat(browsersrc)
.toString()
.split(/[\n\r]/)
}
let conf = vsc.workspace.getConfiguration('Scss2css')
Object.assign(options, conf)
options.output = options.output.split('|').map(it => it.trim())
prefixer = postcss().use(
autoprefixer({
browsers: options.browsers
})
)
vsc.workspace.onDidSaveTextDocument(doc => {
Compiler.filter(doc)
})

1057
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
"name": "scss-to-css",
"displayName": "scss-to-css",
"description": "最简单易用的SCSS编译器, 可自动编译scss文件及补全前缀",
"version": "1.0.0",
"version": "1.0.2",
"publisher": "yutent",
"author": "Yutent [@yutent]",
"icon": "logo.png",