提交 20a715fd 编写于 作者: fxy060608's avatar fxy060608

wip(app): nvue styler

上级 0c8f7396
import { objectifier } from '../src'
import { parseCss } from './utils'
import { objectifier, parse } from '../src'
async function objectifierRule(input: string) {
const { root, messages } = await parseCss(input)
const { root, messages } = await parse(input, { logLevel: 'NOTE' })
return {
json: objectifier(root),
messages,
......
import { objectifier } from '../src'
import { parseCss } from './utils'
import { objectifier, parse } from '../src'
async function objectifierRoot(input: string) {
const { root, messages } = await parseCss(input)
const { root, messages } = await parse(input, { logLevel: 'NOTE' })
return {
json: objectifier(root),
messages,
......
......@@ -17,9 +17,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"parse-css-font": "^4.0.0"
},
"devDependencies": {
"parse-css-font": "^4.0.0",
"postcss": "^8.4.5"
}
}
export { expand } from './expand'
export { normalize } from './normalize'
export { objectifier } from './objectifier'
export { parse } from './parse'
......@@ -13,8 +13,8 @@ import { normalizeMap } from './map'
const normalized = Symbol('normalized')
interface NormalizeOptions {
descendant?: false
export interface NormalizeOptions {
descendant?: boolean
logLevel?: 'NOTE' | 'WARNING' | 'ERROR'
}
......
import postcss from 'postcss'
import { NormalizeOptions } from './normalize'
import { expand, normalize } from '../src'
export function parseCss(input: string, filename: string = 'foo.css') {
return postcss([expand, normalize({ descendant: false, logLevel: 'NOTE' })])
interface ParseOpitons extends NormalizeOptions {
filename?: string
}
export function parse(input: string, options: ParseOpitons = {}) {
return postcss([expand, normalize(options)])
.process(input, {
from: filename,
from: options.filename || 'foo.css',
})
.catch((err: any) => {
return {
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册