mirror of
https://github.com/ritz078/transform.git
synced 2026-11-21 00:32:56 +03:00
21 lines
380 B
TypeScript
21 lines
380 B
TypeScript
import postcssJs from "postcss-js";
|
|
import postcss from "postcss";
|
|
|
|
const _self: any = self;
|
|
|
|
_self.onmessage = ({ data: { payload, id } }) => {
|
|
try {
|
|
const root = postcss.parse(payload);
|
|
|
|
_self.postMessage({
|
|
id,
|
|
payload: JSON.stringify(postcssJs.objectify(root))
|
|
});
|
|
} catch (e) {
|
|
_self.postMessage({
|
|
id,
|
|
err: e.message
|
|
});
|
|
}
|
|
};
|