wxss-transpiler

raw JSON →
1.0.6 verified Fri May 01 auth: no javascript abandoned

Port of wcsc.exe to JavaScript for transpiling WeChat .wxss files to CSS. Version 1.0.6 (last updated ~2018) compiles lists of .wxss files to CSS strings via Node.js. Lightweight alternative to wcc/wcsc native binaries, works cross-platform (macOS, Linux, Windows). No active maintenance or release cadence; last commit ~7 years ago.

error TypeError: transpile is not a function
cause Attempting to use default import in ESM context or incorrect destructuring.
fix
Use const transpile = require('wxss-transpiler')
error Cannot find module 'wxss-transpiler'
cause Module not installed or typo in package name.
fix
Run npm i wxss-transpiler and ensure node_modules contains it.
error Error: ENOENT: no such file or directory, open '...'
cause Provided file path does not exist or is relative incorrectly.
fix
Use absolute paths or ensure current working directory matches.
deprecated Package is unmaintained. Use native wcsc.exe or Weixin DevTools for production.
fix Consider using @wechat-miniprogram/wxss-compiler or official tools.
breaking No ESM support; only CommonJS require works.
fix Use require() instead of import.
gotcha input must be array of file paths (strings), not globs or content strings.
fix Provide explicit file paths in array.
npm install wxss-transpiler
yarn add wxss-transpiler
pnpm add wxss-transpiler

Transpile a list of .wxss file paths into compiled CSS strings using CommonJS.

const transpile = require('wxss-transpiler');
const fileList = ['./path/to/style.wxss'];
transpile(fileList).then(result => console.log(result));