mirror of
https://github.com/Mibew/docs.mibew.org.git
synced 2025-05-04 07:53:08 +03:00
Clean up building script a little
This commit is contained in:
parent
55014d8507
commit
9c3e1f88c1
34
index.js
34
index.js
@ -5,13 +5,31 @@ var Metalsmith = require('metalsmith'),
|
|||||||
navigation = require('metalsmith-navigation'),
|
navigation = require('metalsmith-navigation'),
|
||||||
bower = require('bower');
|
bower = require('bower');
|
||||||
|
|
||||||
// Install bower dependencies
|
/**
|
||||||
bower.commands.install([], {}, {})
|
* Installs bower dependencies that are needed for docs site.
|
||||||
|
*
|
||||||
|
* @param {Function} callback A function that will be called when the
|
||||||
|
* dependencies are installed.
|
||||||
|
*/
|
||||||
|
var installBowerDependencies = function(callback) {
|
||||||
|
bower.commands.install([], {}, {})
|
||||||
.on('error', function(error) {
|
.on('error', function(error) {
|
||||||
throw error;
|
throw error;
|
||||||
})
|
})
|
||||||
.on('end', function() {
|
.on('end', function() {
|
||||||
// Build the site
|
if (typeof callback === 'function') {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds static HTML pages of the docs site.
|
||||||
|
*
|
||||||
|
* @param {Function} callback A function that will be called when the
|
||||||
|
* pages are built.
|
||||||
|
*/
|
||||||
|
var buildPages = function(callback) {
|
||||||
(new Metalsmith(__dirname))
|
(new Metalsmith(__dirname))
|
||||||
// This data will be available inside the templates
|
// This data will be available inside the templates
|
||||||
.metadata({
|
.metadata({
|
||||||
@ -52,5 +70,13 @@ bower.commands.install([], {}, {})
|
|||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
if (typeof callback === 'function') {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
// Build the site
|
||||||
|
installBowerDependencies(function() {
|
||||||
|
buildPages();
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user