Add base for theming
@@ -16,7 +16,7 @@ module.exports = function (grunt) {
|
||||
optimization: 2
|
||||
},
|
||||
files: {
|
||||
"assets/static/style.css": "assets/stylesheets/main.less"
|
||||
"theme/assets/style.css": "theme/stylesheets/main.less"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -24,8 +24,8 @@ module.exports = function (grunt) {
|
||||
compile: {
|
||||
options: {
|
||||
name: "app",
|
||||
baseUrl: "assets/javascript/",
|
||||
out: "assets/static/app.js",
|
||||
baseUrl: "theme/javascript/",
|
||||
out: "theme/assets/app.js",
|
||||
preserveLicenseComments: false,
|
||||
optimize: "uglify",
|
||||
include: ["requireLib"],
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
var util = require("util");
|
||||
var path = require("path");
|
||||
var Q = require("q");
|
||||
var _ = require("lodash");
|
||||
var swig = require('swig');
|
||||
|
||||
var fs = require("../fs");
|
||||
@@ -20,8 +21,13 @@ swig.setFilter('mdLink', function(link) {
|
||||
var Generator = function() {
|
||||
BaseGenerator.apply(this, arguments);
|
||||
|
||||
// Options
|
||||
this.options = _.defaults(this.options, {
|
||||
theme: path.resolve(__dirname, '../../../theme')
|
||||
});
|
||||
|
||||
// Load base template
|
||||
this.template = swig.compileFile(path.resolve(__dirname, '../../templates/page.html'));
|
||||
this.template = swig.compileFile(path.resolve(this.options.theme, 'templates/page.html'));
|
||||
};
|
||||
util.inherits(Generator, BaseGenerator);
|
||||
|
||||
@@ -82,7 +88,7 @@ Generator.prototype.finish = function() {
|
||||
)
|
||||
.then(function() {
|
||||
return fs.copy(
|
||||
path.join(__dirname, "../../assets/static"),
|
||||
path.join(that.options.theme, "assets"),
|
||||
path.join(that.options.output, "gitbook")
|
||||
);
|
||||
});
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# GitBook Theme
|
||||
|
||||
For creating a theme for GitBook, just copy this folder. The theme folder should at least contains two folders: `assets` and `templates`.
|
||||
|
Before Width: | Height: | Size: 198 KiB After Width: | Height: | Size: 198 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |