Skip to content

Commit

Permalink
Use os.tmpdir() folder for temporary css
Browse files Browse the repository at this point in the history
  • Loading branch information
bezoerb committed Feb 4, 2015
1 parent 2c97bc6 commit 849ce3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -42,6 +42,7 @@
"oust": "^0.2.0",
"penthouse": "0.2.53",
"slash": "^1.0.0",
"tempfile": "^1.1.0",
"tmp": "0.0.24"
},
"devDependencies": {
Expand Down
12 changes: 5 additions & 7 deletions src/critical.js
Expand Up @@ -17,6 +17,7 @@ var sourceInliner = require('inline-critical');
var imageInliner = require('imageinliner');
var Promise = require("bluebird");
var os = require('os');
var tempfile = require('tempfile');


// promisify fs and penthouse
Expand Down Expand Up @@ -155,13 +156,10 @@ exports.generate = function (opts, cb) {

// write contents to tmp file
}, '').then(function (css) {
return tmpfile({dir: opts.base, postfix: '.css'})
.then(resolveTmp)
.then(function(path){
return fs.writeFileAsync(path,css).then(function(){
return path;
});
});
var csspath = tempfile('.css');
return fs.writeFileAsync(csspath,css).then(function(){
return csspath;
});

// let penthouseAsync do the rest
}).then(function (csspath) {
Expand Down

0 comments on commit 849ce3b

Please sign in to comment.