修复autoprefixer的配置
parent
9c97ded959
commit
9563e8adbe
|
@ -9,6 +9,7 @@
|
|||
# Files that might appear on external disk
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
package-lock.json
|
||||
|
||||
node_modules
|
||||
*.vsix
|
|
@ -1,3 +1,4 @@
|
|||
.vscode/**
|
||||
package-lock.json
|
||||
.gitignore
|
||||
|
||||
|
|
32
index.js
32
index.js
|
@ -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)
|
||||
})
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue