summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-01-21 23:03:09 +0100
committerSamy Pessé <samypesse@gmail.com>2015-01-21 23:03:09 +0100
commita492c66321e4b32d77e0d5d6456c3a266c75111d (patch)
tree4abc9dacdad6855fc55228239e2faa949b2ed729
parent85930161f7a32c6c5c7de82a47554ed2855c14df (diff)
downloadgitbook-a492c66321e4b32d77e0d5d6456c3a266c75111d.zip
gitbook-a492c66321e4b32d77e0d5d6456c3a266c75111d.tar.gz
gitbook-a492c66321e4b32d77e0d5d6456c3a266c75111d.tar.bz2
Copy files from book to output
Add test for personalised styles
-rw-r--r--lib/generator.js2
-rw-r--r--lib/generators/site.js5
-rw-r--r--test/fixtures/test0/styles/website.css3
-rw-r--r--test/generation.js9
4 files changed, 13 insertions, 6 deletions
diff --git a/lib/generator.js b/lib/generator.js
index a16af16..ab45987 100644
--- a/lib/generator.js
+++ b/lib/generator.js
@@ -46,7 +46,7 @@ BaseGenerator.prototype.writeParsedFile = function(page, input) {
// Copy file to the output (non parsable)
BaseGenerator.prototype.transferFile = function(input) {
return fs.copy(
- path.join(this.options.input, input),
+ path.join(this.book.root, input),
path.join(this.options.output, input)
);
};
diff --git a/lib/generators/site.js b/lib/generators/site.js
index ffcd005..d05e322 100644
--- a/lib/generators/site.js
+++ b/lib/generators/site.js
@@ -87,11 +87,6 @@ Generator.prototype.prepareTemplates = function() {
return Q();
};
-// Ignore some methods
-Generator.prototype.transferFile = function(input) {
-
-};
-
// Finis generation
Generator.prototype.finish = function() {
return this.copyAssets()
diff --git a/test/fixtures/test0/styles/website.css b/test/fixtures/test0/styles/website.css
new file mode 100644
index 0000000..f0d5b13
--- /dev/null
+++ b/test/fixtures/test0/styles/website.css
@@ -0,0 +1,3 @@
+body {
+ background: red;
+}
diff --git a/test/generation.js b/test/generation.js
index 1d73068..a8f9c69 100644
--- a/test/generation.js
+++ b/test/generation.js
@@ -54,4 +54,13 @@ describe('Book generation', function () {
assert(fs.existsSync(path.join(output, "index.html")));
}, done);
});
+
+ it('should correctly include styles in website', function(done) {
+ testGeneration(books[0], "site", function(output) {
+ assert(fs.existsSync(path.join(output, "styles/website.css")));
+
+ var INDEX = fs.readFileSync(path.join(output, "index.html")).toString();
+ assert(INDEX.indexOf("styles/website.css") > 0);
+ }, done);
+ });
});