UNPKG

cssclasscrafter

Version:

CSSClassCrafter is an npm library that enables developers to dynamically generate CSS classes based on user-defined configuration files. With a simple JSON format for specifying styles, it streamlines the styling process, allowing for easy customization a

11 lines (8 loc) 365 B
export function isValidCSSLength(value) { // Trim any leading/trailing spaces value = value.trim(); // Regex to validate CSS lengths with numeric values and valid units const validCSSLengthRegex = /^(\d+(?:\.\d+)?)(px|em|rem|%|vw|vh|vmin|vmax)$/; // Test the value against the regex return validCSSLengthRegex.test(value); }