Browse Source

Use Node resolving mechanism to locate Prism CSS

Dan Abramov 9 years ago
parent
commit
903456c8c2
1 changed files with 6 additions and 4 deletions
  1. 6 4
      index.js

+ 6 - 4
index.js

@@ -1,12 +1,14 @@
 var Prism = require('prismjs');
 var Prism = require('prismjs');
 var cheerio = require('cheerio');
 var cheerio = require('cheerio');
+var path = require('path');
+
+var cssFile = require.resolve('prismjs/themes/prism.css');
+var cssDirectory = path.dirname(cssFile);
 
 
 module.exports = {
 module.exports = {
   book: {
   book: {
-    assets: './node_modules/prismjs/themes',
-    css: [
-      'prism.css'
-    ]
+    assets: cssDirectory,
+    css: [path.basename(cssFile)]
   },
   },
   hooks: {
   hooks: {
     page: function (page) {
     page: function (page) {