1.0.2 • Published 3 years ago
cssom-lite v1.0.2
CSSOM Lite
Generate css with javascript
Import and register device:
import CSSOMLite from 'cssom-lite';
const sheet = new CSSOMLite();
// register devices
sheet.addDevice('mobile', 575);
sheet.addDevice('tablet', 768);
sheet.addDevice('laptop', 911);
Add custom plain css text
sheet.addCSS(`
@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');
* {
margin: 0;
padding: 0;
}
`)
Add rule
sheet.addRule('.selector-a', 'background: orange');
sheet.addRule('.selector-a', 'color: white; text-decoration:none');
Add responsive rule
sheet.addRule('.selector-a', 'text-decoration: underline', {max: 'mobile'});
sheet.addRule('.selector-heading', 'font-size: 24px', {min: 'mobile', max: 'tablet'});
Clear everything
sheet.clear();
Get output
sheet.output()