2
2
var got = require ( 'got' ) ;
3
3
var cheerio = require ( 'cheerio' ) ;
4
4
var uncss = require ( 'uncss' ) ;
5
- var tempWrite = require ( 'temp-write' ) ;
6
5
7
6
function getCss ( cb ) {
8
7
got ( 'https://github.com' , function ( err , data ) {
@@ -26,14 +25,17 @@ function getCss(cb) {
26
25
}
27
26
28
27
function getRenderedFixture ( cb ) {
29
- got ( 'https://github.com/sindresorhus/github-markdown-css/blob/gh-pages/fixture.md' , function ( err , data ) {
28
+ var url = 'https://github.com/sindresorhus/github-markdown-css/blob/gh-pages/fixture.md' ;
29
+
30
+ got ( url , function ( err , data ) {
30
31
if ( err ) {
31
32
return cb ( err ) ;
32
33
}
33
34
34
35
var $ = cheerio . load ( data ) ;
36
+ var html = $ ( '.markdown-body' ) . parent ( ) . html ( ) ;
35
37
36
- cb ( null , tempWrite . sync ( $ ( '.markdown-body' ) . parent ( ) . html ( ) ) ) ;
38
+ cb ( null , html ) ;
37
39
} ) ;
38
40
}
39
41
@@ -99,7 +101,7 @@ function cleanupCss(str) {
99
101
}
100
102
101
103
module . exports = function ( cb ) {
102
- getRenderedFixture ( function ( err , fixture ) {
104
+ getRenderedFixture ( function ( err , html ) {
103
105
if ( err ) {
104
106
return cb ( err ) ;
105
107
}
@@ -109,7 +111,7 @@ module.exports = function (cb) {
109
111
return cb ( err ) ;
110
112
}
111
113
112
- uncss ( [ fixture ] , {
114
+ uncss ( html , {
113
115
stylesheets : stylesheets ,
114
116
ignore : [ / ^ \. h i g h l i g h t / ]
115
117
} , function ( err , css ) {
0 commit comments