File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -110,8 +110,6 @@ import codeTemplate from "!!raw-loader!./assets/PureTemplate.html";
110110import codeChicago from " !!raw-loader!./assets/Chicago.jsx" ;
111111import all from " ./assets/chicagoNeighbourhoods" ;
112112import " prismjs/themes/prism-tomorrow.css" ;
113- // vue-prism-editor dependency
114- import " vue-prism-editor/dist/prismeditor.min.css" ;
115113
116114import GithubCorners from " vue-github-corners" ;
117115
Original file line number Diff line number Diff line change 11import * as path from "path" ;
22import commonjs from "@rollup/plugin-commonjs" ;
33import babel from "@rollup/plugin-babel" ;
4+ import node from "@rollup/plugin-node-resolve" ;
45import vue from "rollup-plugin-vue" ;
56import css from "rollup-plugin-css-only" ;
67import analyze from "rollup-plugin-analyzer" ;
@@ -12,6 +13,7 @@ const rootConfig = {
1213 input : resolve ( "./src/index.js" ) ,
1314 plugins : [
1415 commonjs ( ) ,
16+ node ( ) ,
1517 babel ( {
1618 babelrc : false ,
1719 // avoid using babel.config.js. It kills es6 modules for ie compatibility
@@ -55,6 +57,9 @@ export default [
5557 file : pkg . main ,
5658 exports : "named" , // remove warning about mixed exports
5759 } ,
58- plugins : [ ...rootConfig . plugins , vue ( { template : { optimizeSSR : true } } ) ] ,
60+ plugins : [
61+ ...rootConfig . plugins ,
62+ vue ( { css : false , template : { optimizeSSR : true } } ) ,
63+ ] ,
5964 } ,
6065] ;
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import "prismjs/components/prism-clike";
1818import " prismjs/components/prism-markup" ;
1919import " prismjs/components/prism-javascript" ;
2020import " prismjs/components/prism-jsx" ;
21+ import " vue-prism-editor/dist/prismeditor.min.css" ;
2122
2223import debounce from " debounce" ;
2324import getScript from " ./utils/getScript" ;
@@ -40,14 +41,20 @@ const highlight = (lang, jsxInExamples) => {
4041 return scriptCodeHighlighted;
4142 }
4243 const templateCode = code .slice (scriptCode .length );
44+ const templateHighlighted = prismHighlight (templateCode, languages[" html" ], lang)
4345 return (
4446 scriptCodeHighlighted +
45- prismHighlight (templateCode, languages[ " html " ], lang)
47+ templateHighlighted
4648 );
4749 };
4850 } else {
49- const langScheme = languages[lang];
50- return (code ) => prismHighlight (code, langScheme, lang);
51+ return (code ) => {
52+ const langScheme = languages[lang];
53+ if (! langScheme){
54+ return code
55+ }
56+ return prismHighlight (code, langScheme, lang);
57+ }
5158 }
5259};
5360
You can’t perform that action at this time.
0 commit comments