Importing a Less file as a CSS module in JavaScript or TypeScript:
import * as classes './style.module.less';
document.body.className = classes.body;
Directly compiling Less using the Parcel CLI
parcel build style.less
To configure Less, create a .lessrc
file. To see the available options to configure Less see the official Less documentation.
Note: .lessrc.js
is 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. .lessrc
) instead.