Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Remove all the files from the bundle
Browse files Browse the repository at this point in the history
The show invisibles plugin needs to be handled
differently. A PR is open upstream to resolve this
issue: PrismJS/prism#874

Fixes #49
  • Loading branch information
mAAdhaTTah committed Jan 30, 2016
1 parent dfdc65c commit 4bd017c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 53 deletions.
52 changes: 0 additions & 52 deletions src/js/prism/compiled.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,3 @@
var Prism = require('prismjs/components/prism-core');
require('prismjs/components/prism-markup');
require('prismjs/components/prism-css');
require('prismjs/components/prism-clike');
require('prismjs/components/prism-javascript');
require('prismjs/components/prism-php');
require('prismjs/components/prism-bash');
require('prismjs/components/prism-groovy');
require('prismjs/components/prism-java');
require('prismjs/components/prism-python');
require('prismjs/components/prism-ruby');
require('prismjs/components/prism-scala');
require('prismjs/components/prism-scss');
require('prismjs/components/prism-sql');
// New languages - v0.3.0
require('prismjs/components/prism-c');
require('prismjs/components/prism-coffeescript');
require('prismjs/components/prism-csharp');
require('prismjs/components/prism-go');
require('prismjs/components/prism-http');
require('prismjs/components/prism-ini');
require('prismjs/components/prism-markup');
require('prismjs/components/prism-objectivec');
require('prismjs/components/prism-swift');
require('prismjs/components/prism-twig');
// New languages - v0.5.0
require('prismjs/components/prism-actionscript');
require('prismjs/components/prism-applescript');
require('prismjs/components/prism-dart');
require('prismjs/components/prism-eiffel');
require('prismjs/components/prism-erlang');
require('prismjs/components/prism-gherkin');
require('prismjs/components/prism-git');
require('prismjs/components/prism-haml');
require('prismjs/components/prism-handlebars');
require('prismjs/components/prism-jade');
require('prismjs/components/prism-latex');
require('prismjs/components/prism-less');
require('prismjs/components/prism-markdown');
require('prismjs/components/prism-matlab');
require('prismjs/components/prism-nasm');
require('prismjs/components/prism-perl');
require('prismjs/components/prism-powershell');
require('prismjs/components/prism-r');
require('prismjs/components/prism-rust');
require('prismjs/components/prism-scheme');
require('prismjs/components/prism-smarty');
// Plugins
require('prismjs/plugins/line-highlight/prism-line-highlight');
require('prismjs/plugins/line-numbers/prism-line-numbers');
require('prismjs/plugins/show-invisibles/prism-show-invisibles');

document.removeEventListener('DOMContentLoaded', Prism.highlightAll);

module.exports = Prism;
19 changes: 18 additions & 1 deletion src/js/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,28 @@ promises.push(Prism.loadTheme(Gistpen_Settings.prism.theme));
forOwn(Gistpen_Settings.prism.plugins, function(props, plugin) {
if (props.enabled) {
promises.push(Prism.loadPlugin(plugin));
if ('show-invisibles' === plugin) {
showInvisibles = true;
}
}
});

Plite.all(promises)
.then(Prism.highlightAll)
.then(function() {
if (showInvisibles) {
// @todo https://github.com/PrismJS/prism/pull/874
Prism.hooks.add('before-highlight', function(env) {
var tokens = env.grammar;

tokens.tab = /\t/g;
tokens.crlf = /\r\n/g;
tokens.lf = /\n/g;
tokens.cr = /\r/g;
});
}

Prism.highlightAll();
})
.catch(function(err) {
console.error(err);
});

0 comments on commit 4bd017c

Please sign in to comment.