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

Fix for #336 #337

Merged
merged 3 commits into from
May 26, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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