Initial commit

This commit is contained in:
Tom Raithel
2017-01-20 07:23:25 +01:00
commit 37ae2943d5
9 changed files with 136 additions and 0 deletions

24
scripts/clean.js Normal file
View File

@@ -0,0 +1,24 @@
var fs = require('fs-extra');
var async = require('async');
var file = require('./file');
var distDir = file.distDir();
console.log('<<< start cleaning dist dir: ', distDir);
async.series([
function(callback) {
fs.ensureDir(distDir, callback);
},
function(callback) {
fs.emptyDir(distDir, callback);
}
],
function(err, results) {
if (!err) {
console.log('done cleaning dist dir >>>');
} else {
console.error(err);
}
}
);

21
scripts/create.js Normal file
View File

@@ -0,0 +1,21 @@
var fs = require('fs-extra');
var frontmatter = require('front-matter');
var marked = require('marked');
var file = require('./file');
var fileName = file.path('radar/v1/tools/grunt.md');
fs.readFile(fileName, 'utf8', function(err, data) {
if (err) throw err;
var item = frontmatter(data);
var html = marked(item.body);
console.log(item.attributes);
console.log(html);
fs.outputFile(file.distDir() + '/test.html', html, function (err) {
console.log(err) // => null
})
});

10
scripts/file.js Normal file
View File

@@ -0,0 +1,10 @@
var path = require('path');
module.exports = {
path: function(relativePath) {
return path.resolve(__dirname, '..', relativePath)
},
distDir: function() {
return this.path('dist');
}
};