1 |
|
2 | var fs = require('fs');
|
3 | var getCss = require('../');
|
4 |
|
5 | var results = [];
|
6 |
|
7 | function writeLog () {
|
8 | fs.writeFileSync('./test/results.json', JSON.stringify(results, null, 2));
|
9 | }
|
10 |
|
11 | function 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 |
|
22 | getCss('http://google.com')
|
23 | .then(logResults)
|
24 | .catch(function (err) {
|
25 | console.error(err);
|
26 | });
|
27 |
|
28 | getCss('http://amazon.com')
|
29 | .then(logResults)
|
30 | .catch(function (err) {
|
31 | console.error(err);
|
32 | });
|
33 |
|
34 | getCss('http://twitter.com/jxnblk')
|
35 | .then(logResults)
|
36 | .catch(function (err) {
|
37 | console.error(err);
|
38 | });
|
39 |
|
40 | getCss('http://facebook.com')
|
41 | .then(logResults)
|
42 | .catch(function (err) {
|
43 | console.error(err);
|
44 | });
|
45 |
|
46 | getCss('http://johnotander.com/public/css/c.min.css')
|
47 | .then(logResults)
|
48 | .catch(function (err) {
|
49 | console.error(err);
|
50 | });
|