Gathering detailed insights and metrics for doiuse
Gathering detailed insights and metrics for doiuse
Gathering detailed insights and metrics for doiuse
Gathering detailed insights and metrics for doiuse
stylelint-no-unsupported-browser-features
Disallow features that are unsupported by the browsers that you are targeting
@jsx-email/doiuse-email
Lint CSS for email support against caniemail database.
doiuse-email
Lint CSS for email support against caniemail database.
@rjwadley/doiuse
Lint CSS for browser support against caniuse database
💣 Lint CSS for browser support against caniuse database.
npm install doiuse
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (56.48%)
CSS (43.5%)
Shell (0.02%)
Total Downloads
77,302,463
Last Day
63,115
Last Week
375,286
Last Month
1,518,760
Last Year
16,784,456
MIT License
1,279 Stars
357 Commits
54 Forks
17 Watchers
4 Branches
35 Contributors
Updated on May 09, 2025
Latest Version
6.0.5
Package Id
doiuse@6.0.5
Unpacked Size
381.82 kB
Size
99.79 kB
File Count
676
NPM Version
10.5.0
Node Version
20.12.2
Published on
Oct 21, 2024
Cumulative downloads
Total Downloads
Last Day
45%
63,115
Compared to previous day
Last Week
8.5%
375,286
Compared to previous week
Last Month
-1.2%
1,518,760
Compared to previous month
Last Year
46.2%
16,784,456
Compared to previous year
22
Lint CSS for browser support against Can I use database.
1npm install -g doiuse
1doiuse --browsers "ie >= 9, > 1%, last 2 versions" main.css 2# or 3cat main.css | doiuse --browsers "ie >= 9, > 1%, last 2 versions"
Sample output:
/projects/website/main.css:5:3: CSS3 Box-sizing not supported by: IE (8,9,10,11), Chrome (36,37,38), Safari (8,7.1), Opera (24,25), iOS Safari (8,7.1,8.1), Android Browser (4.1,4.4,4.4.4), IE Mobile (10,11)
/projects/website/main.css:6:3: CSS3 Box-sizing not supported by: IE (8,9,10,11), Chrome (36,37,38), Safari (8,7.1), Opera (24,25), iOS Safari (8,7.1,8.1), Android Browser (4.1,4.4,4.4.4), IE Mobile (10,11)
/projects/website/main.css:8:3: CSS user-select: none not supported by: IE (8,9)
/projects/website/main.css:9:3: CSS user-select: none not supported by: IE (8,9)
/projects/website/main.css:10:3: CSS user-select: none not supported by: IE (8,9)
/projects/website/main.css:11:3: CSS user-select: none not supported by: IE (8,9)
/projects/website/main.css:12:3: CSS user-select: none not supported by: IE (8,9)
/projects/website/main.css:13:3: Pointer events not supported by: IE (8,9,10), Firefox (32,33), Chrome (36,37,38), Safari (8,7.1), Opera (24,25), iOS Safari (8,7.1,8.1), Android Browser (4.1,4.4,4.4.4), IE Mobile (10)
/projects/website/main.css:14:3: Pointer events not supported by: IE (8,9,10), Firefox (32,33), Chrome (36,37,38), Safari (8,7.1), Opera (24,25), iOS Safari (8,7.1,8.1), Android Browser (4.1,4.4,4.4.4), IE Mobile (10)
/projects/website/main.css:32:3: CSS3 Transforms not supported by: IE (8)
Use --json
to get output as (newline-delimited) JSON objects.
1import postcss from 'postcss'; 2import DoIUse from 'doiuse/lib/DoIUse.js'; 3 4postcss(new DoIUse({ 5 browsers:['ie >= 6', '> 1%'], 6 ignore: ['rem'], // an optional array of features to ignore 7 ignoreFiles: ['**/normalize.css'], // an optional array of file globs to match against original source file path, to ignore 8 onFeatureUsage: (usageInfo) => { 9 console.log(usageInfo.message); 10 } 11})).process("a { background-size: cover; }")
CommonJS syntax is still supported if using var doiuse = require('doiuse')
.
1var gulp = require('gulp') 2var postcss = require('postcss') 3var doiuse = require('doiuse') 4 5gulp.src(src, { cwd: process.cwd() }) 6.pipe(gulp.postcss([ 7 doiuse({ 8 browsers: [ 9 'ie >= 8', 10 '> 1%' 11 ], 12 ignore: ['rem'], // an optional array of features to ignore 13 ignoreFiles: ['**/normalize.css'], // an optional array of file globs to match against original source file path, to ignore 14 onFeatureUsage: function (usageInfo) { 15 console.log(usageInfo.message) 16 } 17 }) 18]))
In particular, the approach to detecting features usage is currently quite naive.
Refer to the data in /data/features.js.
properties
, we just use those
properties for regex/substring matches against the properties used in the input CSS.values
, then we also require that the associated
value matches one of those values.1var doiuse = require('doiuse/stream'); 2 3process.stdin 4 .pipe(doiuse({ browsers: ['ie >= 8', '> 1%'], ignore: ['rem'] })) 5 .on('data', function (usageInfo) { 6 console.log(JSON.stringify(usageInfo)) 7 })
Yields UsageInfo
objects as described below.
postcss(new DoIUse(opts)).process(css)
, where opts
is:
1{ 2 browsers: ['ie >= 8', '> 1%'], // an autoprefixer-like array of browsers. 3 ignore: ['rem'], // an optional array of features to ignore 4 ignoreFiles: ['**/normalize.css'], // an optional array of file globs to match against original source file path, to ignore 5 onFeatureUsage: function(usageInfo) { } // a callback for usages of features not supported by the selected browsers 6}
And usageInfo
looks like this:
1{ 2 message: '<input source>: line <l>, col <c> - CSS3 Gradients not supported by: IE (8)', 3 feature: 'css-gradients', // slug identifying a caniuse-db feature 4 featureData: { 5 title: 'CSS Gradients', 6 missing: "IE (8)", // string of browsers missing support for this feature. 7 missingData: { 8 // map of browser -> version -> (lack of)support code 9 ie: { '8': 'n' } 10 }, 11 caniuseData: { // data from caniuse-db/features-json/[feature].json } 12 }, 13 usage: {} //the postcss node where that feature is being used. 14}
Called once for each usage of each css feature not supported by the selected browsers.
For disabling some checks you can use just-in-place comments
/* doiuse-disable */
Disables checks of all features
/* doiuse-disable feature */
Disables checks of specified feature(s) (can be comma separated list)
/* doiuse-enable */
Re-enables checks of all features
/* doiuse-enable feature */
Enables checks of specified feature(s) (can be comma separated list)
doiuse is an OPEN Open Source Project.
This means that individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
MIT
NOTE: Many of the files in test/cases are from autoprefixer-core, Copyright 2013 Andrey Sitnik andrey@sitnik.ru. Please see https://github.com/postcss/autoprefixer-core.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
4 existing vulnerabilities detected
Details
Reason
Found 6/18 approved changesets -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More