Crates.io | glass-easel-stylesheet-compiler |
lib.rs | glass-easel-stylesheet-compiler |
version | 0.10.3 |
source | src |
created_at | 2023-02-03 07:08:15.038005 |
updated_at | 2024-10-17 13:00:13.450328 |
description | The stylesheet compiler of the glass-easel project. |
homepage | https://github.com/wechat-miniprogram/glass-easel |
repository | https://github.com/wechat-miniprogram/glass-easel |
max_upload_size | |
id | 775415 |
size | 85,863 |
The stylesheet compiler for the glass-easel project.
This tool can help:
rpx
to vw
;Refer to the glass-easel project for further details.
rust
toolchain and wasm-pack
should be globally installed.
Build WebAssembly binary:
wasm-pack build glass-easel-stylesheet-compiler --target nodejs --out-dir pkg-nodejs
Build binary:
cargo build --release
This tool can be used in webpack, i.e. glass-easel-miniprogram-webpack-plugin .
However, if you want to call it directly, see the example below.
const { StyleSheetTransformer } = require('glass-easel-stylesheet-compiler')
// convert a CSS file
const rpxRatio = 750
const sst = new StyleSheetTransformer(PATH, CONTENT, CLASS_PREFIX, rpxRatio)
// get the CSS output
const ss = sst.getContent()
// get the source map if needed
sst.toSourceMap()
// free it if the source map is not required
sst.free()