glass-easel-stylesheet-compiler
TypeScript icon, indicating that this package has built-in type declarations

0.5.3 • Public • Published

glass-easel-stylesheet-compiler

The stylesheet compiler for the glass-easel project.

This tool can help:

  • convert rpx to vw ;
  • work with style isolation options through class-prefixes;
  • minify the output CSS.

Refer to the glass-easel project for further details.

Build

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

JavaScript Interface

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()

Readme

Keywords

none

Package Sidebar

Install

npm i glass-easel-stylesheet-compiler

Weekly Downloads

99

Version

0.5.3

License

MIT

Unpacked Size

242 kB

Total Files

6

Last publish

Collaborators

  • lastleaf
  • wechat-miniprogram