UNPKG

1.05 kBJavaScriptView Raw
1
2var fs = require('fs');
3var getCss = require('../');
4
5var results = [];
6
7function writeLog () {
8 fs.writeFileSync('./test/results.json', JSON.stringify(results, null, 2));
9}
10
11function logResults (response) {
12 results.push(response);
13 console.log('Results from: ', response.pageTitle);
14 console.log(response.styles.length + ' Style Tags');
15 console.log(response.links.length + ' Stylesheets');
16 response.links.forEach(function (link) {
17 console.log(link.url);
18 });
19 writeLog();
20}
21
22getCss('http://google.com')
23 .then(logResults)
24 .catch(function (err) {
25 console.error(err);
26 });
27
28getCss('http://amazon.com')
29 .then(logResults)
30 .catch(function (err) {
31 console.error(err);
32 });
33
34getCss('http://twitter.com/jxnblk')
35 .then(logResults)
36 .catch(function (err) {
37 console.error(err);
38 });
39
40getCss('http://facebook.com')
41 .then(logResults)
42 .catch(function (err) {
43 console.error(err);
44 });
45
46getCss('http://johnotander.com/public/css/c.min.css')
47 .then(logResults)
48 .catch(function (err) {
49 console.error(err);
50 });