Skip to content
This repository has been archived by the owner on May 29, 2020. It is now read-only.

Commit

Permalink
Create folder for HTML demo if it doesn’t exist (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
irfan authored and sapegin committed May 26, 2016
1 parent 83d46dd commit f4b5980
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions tasks/webfont.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,10 +515,16 @@ module.exports = function(grunt) {
var demoTemplate = readTemplate(o.htmlDemoTemplate, 'demo', '.html');
var demo = renderTemplate(demoTemplate, context);

// Save file
fs.writeFileSync(getDemoFilePath(), demo);
mkdirp(getDemoPath(), function(err) {
if (err) {
logger.log(err);
return;
}
// Save file
fs.writeFileSync(getDemoFilePath(), demo);
done();
});

done();
}

/**
Expand Down Expand Up @@ -758,6 +764,13 @@ module.exports = function(grunt) {
return path.join(o.destHtml, name + '.html');
}

/**
* Return path of HTML demo file or `null` if feature was disabled
*/
function getDemoPath() {
if (!o.htmlDemo) return null;
return o.destHtml;
}

/**
* Save hash to cache file.
Expand Down

0 comments on commit f4b5980

Please sign in to comment.