Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter eyalroth

    (@eyalroth)

    @specialk Here’s a python script which generates all the lang-x.js files from a given directory of prism-x.js files (as they are in the prism.js repository). It also generates the “array” parts to be pasted in the resources-enqueue.php file:

    https://gist.github.com/eyalroth/20421d5ea04795db47a00f2837228ff9

    Thread Starter eyalroth

    (@eyalroth)

    @specialk Why would it require a massive amount of time?

    Looks like the prism part of the plugin already follows the “file-per-language” structure, so it’s basically only a manner of adding the language’s file to lib/prism/js and including it in inc/resources-enqueue.js.

    I can tell that the plugin doesn’t automatically load dependency languages (for instance, for Scala that would be Java) and each language file must inline the code of the dependency language as well. I’m not a php / javascript programmer, but I would imagine it is possible to make the plugin automatically load the dependency languages; otherwise, it is possible to make a helper script that transforms the original language files to ones with the dependency languages inlined.

    As for the plugin size – does it really matter if the plugin would weigh an extra MB? Obviously the plugin should not serve the entire language-set for every page, but only the relevant language-files. It already does so with prism.js, but with highlight.js it seems that the structure is different and includes all of the languages in one big file (lib/highlight/js/highlight-core.js). I guess it’s possible to transform this part of the plugin to work with “file-per-language” structure as well?

    • This reply was modified 7 years, 3 months ago by eyalroth.
Viewing 2 replies - 1 through 2 (of 2 total)