Get started with csslint CDN
MIT licensed
CSSLint: library for analyzing CSS, reporting potential errors and warnings.
Tags:- css
- styling
- lint
- linting
Stable version
Copied!
How to start using csslint CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with csslint CDN - cdnhub.io</title>
<style>
/* Your CSS code goes here */
.example {
color: red;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/css-loader/dist/css-loader.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/style-loader/dist/style-loader.min.js"></script>
<script src="https://cdn.cdnhub.io/csslint/1.0.5/csslint.js"></script>
<script>
const css = document.querySelector('style:last-of-type');
const errors = [];
css.sheet.rules.forEach((rule) => {
const result = csslint.processString(rule.style.cssText, {
filename: 'styles.css',
reporter: 'fail',
});
if (result.messages.length > 0) {
result.messages.forEach((message) => {
errors.push(message.text);
});
}
});
if (errors.length > 0) {
console.log('CSS Lint Errors:');
console.log(errors.join('\n'));
}
</script>
</head>
<body>
<div class="example">Hello, World!</div>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!