Comments (6)
@dominikwilkowski There are a couple of ways:
- streaming (take note of the first require--
doiuse/stream
)
var fs = require('fs')
var doiuse = require('doiuse/stream');
fs.createReadStream('/path/to/your/file.css')
.pipe(doiuse(['ie >= 8', '> 1%']))
.on('data', function(usageInfo) {
console.log(usageInfo.message)
}
- as a postcss plugin
var fs= require('fs')
var postcss = require('postcss')
var doiuse = require('doiuse')
postcss(doiuse({
browsers:['ie >= 6', '> 1%'],
onFeatureUsage: function(usageInfo) {
console.log(usageInfo.message);
}
}))
.process(fs.readFileSync('/path/to/your.css')
from doiuse.
great! Thanks.
from doiuse.
No problem!
I'm gonna reopen this till I get a chance to add this to the readme.
from doiuse.
No worries...
In that case I might as well keep asking things ;)
var fs = require('fs');
var doiuse = require('doiuse');
var sourceFile = 'test/fixtures/backgrounds.css';
var OPTIONS = [];
OPTIONS.browsers = [ '> 1%', 'last 2 versions', 'Firefox ESR', 'Opera 12.1' ];
fs
.createReadStream( sourceFile )
.pipe( doiuse( OPTIONS.browsers ) )
.on('data', function( usageInfo ) {
console.log(usageInfo.message)
});
This returns:
$ node test.js
_stream_readable.js:495
dest.on('unpipe', onunpipe);
^
TypeError: undefined is not a function
at ReadStream.Readable.pipe (_stream_readable.js:495:8)
at Object.<anonymous> (/Users/dominikwilkowski/Sites/grunt-doiuse/test.js:10:3)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
ps I am running Node v0.12.0
...
Appreciate the help.
from doiuse.
No problem. I think the issue here is in your second line. It should be:
var doiuse = require('doiuse/stream');
(doiuse
is the postcss plugin, doiuse/stream
is a more standalone
stream api)
from doiuse.
that did it! awesome
from doiuse.
Related Issues (20)
- Not getting warnings for flex start and end HOT 3
- .browserslistrc Not Acknowledged by doiuse. HOT 1
- `text-transform` gets incorrectly flagged as `transforms2d` HOT 1
- add support for `scale`, `translate` & `roate` HOT 2
- Using MDN Data HOT 1
- `visibility: visible` trigger viewport-unit-variants warning
- css-not-sel-list error in css module HOT 1
- `overflow-x` and `overflow-y` are wrongly flagged HOT 1
- QQ Browser supports `text-align: end`, but it's flagged HOT 1
- css-not-sel-list matches on leading/trailing whitespace HOT 4
- `mdn-text-decoration-shorthand` is incorrect and needs to be done something about it HOT 3
- grid-template minmax function trigger css-math-functions warning
- "Unclosed block" error when checking nested CSS HOT 3
- ignore error for one line only
- False positive on grid-template-rows: masonry
- Don't report errors when validated with @supports
- `viewport-unit-variants` false positive with data-url
- Provide an option to simplify browser version ranges in `formatBrowserName`
- CI failing in Node 20
- Mistaking the css-variables for the flexbox-gap
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from doiuse.