Browse Source

fix path creation for prism-pdf.css fix

Robert McGuinness 8 years ago
parent
commit
446f69d6cd
1 changed files with 8 additions and 2 deletions
  1. 8 2
      index.js

+ 8 - 2
index.js

@@ -99,10 +99,16 @@ module.exports = {
 
       var book = this;
 
-      var outputDirectory = book.output.root() + '/gitbook/gitbook-plugin-prism';
+      if (book.output.name !== 'ebook') {
+        // Output path is different for websites so just skip the logic below since it
+        // is only valid for ebooks
+        return;
+      }
+
+      var outputDirectory = path.join(book.output.root(), '/gitbook/gitbook-plugin-prism');
       var outputFile = path.resolve(outputDirectory, 'prism-pdf.css');
       var inputFile = path.resolve(__dirname, './prism-pdf.css');
-      mkdirp.sync(outputDirectory + 'gitbook/gitbook-plugin-prism');
+      mkdirp.sync(outputDirectory);
 
       try {
         fs.writeFileSync(outputFile, fs.readFileSync(inputFile));