
Security News
CISA Kills Off RSS Feeds for KEVs and Cyber Alerts
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
grunt-contrib-csslint
Advanced tools
Lint CSS files
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-contrib-csslint --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-contrib-csslint');
Run this task with the grunt csslint
command.
Any specified option will be passed through directly to csslint, thus you can specify any option that csslint supports. The csslint API is a bit awkward: For each rule, a value of false
ignores the rule, a value of 2
will set it to become an error. Otherwise all rules are considered warnings.
For the current csslint version, these rules are available:
For an explanation of those rules, check the csslint wiki.
Side note: To update this list, run this:
node -e "require('csslint').CSSLint.getRules().forEach(function(x) { console.log(x.id) })"
A few additional options are supported:
Type: string
Default: null
If this filename is specified, options and globals defined therein will be used. Task and target options override the options within the .csslintrc
file. It should be a JSON file, but it supports comments:
{
// unicorns
"qualified-headings": true,
"unique-headings": true,
"known-properties": false
}
Type: array
Default: null
If the formatters options is specified, the grunt csslint task is able to use the all formatters provided by csslint.
For the current csslint version, the following formatters are included out of the box:
text
compact
lint-xml
csslint-xml
checkstyle-xml
junit-xml
For an explanation of those formatters, check the csslint wiki, section Options/--format.
You are also able to supply your own custom formatter, such as csslint-stylish. Note that you have to provide the complete module, not just the id. See example.
Type: boolean
Default: false
If the absoluteFilePathsForFormatters
option is specified and set to true
, the file names in the generated reports are absolute.
Type: boolean
Default: false
Only output errors.
Type: boolean
Default: false
Outputs without errors and warnings.
csslint: {
strict: {
options: {
import: 2
},
src: ['path/to/**/*.css']
},
lax: {
options: {
import: false
},
src: ['path/to/**/*.css']
}
}
csslint: {
options: {
csslintrc: '.csslintrc'
},
strict: {
options: {
import: 2
},
src: ['path/to/**/*.css']
},
lax: {
options: {
import: false
},
src: ['path/to/**/*.css']
}
}
csslint: {
options: {
csslintrc: '.csslintrc',
formatters: [
{id: 'junit-xml', dest: 'report/csslint_junit.xml'},
{id: 'csslint-xml', dest: 'report/csslint.xml'}
]
},
strict: {
options: {
import: 2
},
src: ['path/to/**/*.css']
}
}
csslint: {
options: {
csslintrc: '.csslintrc',
formatters: [
{id: require('csslint-stylish'), dest: 'report/csslint_stylish.xml'}
]
},
strict: {
options: {
import: 2
},
src: ['path/to/**/*.css']
}
}
csslint: {
options: {
absoluteFilePathsForFormatters: true,
formatters: [
{id: 'junit-xml', dest: 'report/csslint_junit.xml'},
{id: 'csslint-xml', dest: 'report/csslint.xml'}
]
}
}
.csslintrc
file can now contain comments.Task submitted by Jörn Zaefferer
This file was generated on Thu Sep 22 2016 02:55:13.
FAQs
Lint CSS files
The npm package grunt-contrib-csslint receives a total of 5,761 weekly downloads. As such, grunt-contrib-csslint popularity was classified as popular.
We found that grunt-contrib-csslint demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.