Importing a Stylus file as a CSS module in JavaScript or TypeScript:
import * as classes from './style.module.styl';
document.body.className = classes.body;
Directly compiling Stylus using the Parcel CLI
parcel build style.styl
To configure Stylus, create a .stylusrc
file. To see the available options to configure stylus see the official Stylus documentation.
Note: .stylusrc.js
, .stylusrc.mjs
, and .stylusrc.cjs
are also supported for JavaScript-based configuration, but should be avoided when possible because it reduces the effectiveness of Parcel's caching. Use a JSON based configuration format (e.g. .stylusrc
) instead.