isomorphic-parse
DOM parsing for both node & browserify. A wrapped library of jquery & cheerio.
Installation
NPM
npm install --save isomorphic-parse
Webpack config
If you're using webpack, you would also need the following setup from cheerio build issue.
-
install json-loader
npm install --save-dev json-loader
-
Go to your webpack config and make sure to use the "json-loader" and configure that "cheerio/package" is resolved with the "json-loader".
module: loaders: test: /cheerio\/package$/ loader: 'json'
Usage
const $ =
Note that in node environment, I map cheerio constructor function to find
like this:
// index-node.jsvar cheerio = ;cheeriofind = cheerio;moduleexports = cheerio;
Now in cheerio, we can use find
method in jquery style, but it should be differed from jquery global query style, $(selector)
.
LISENCE
MIT