highlight.jsを軽くする
highlight.jsはたくさん言語が入っているので重い
autoitやmathmaticaなど1言語で100KBぐらいある言語がいくつかある
しかも使わない
Browserifyするとすごいサイズになる
結論
色々やった結果、browserify-shimでCDNから読むのがいい
自分でビルドする場合
GitHubからcloneしてきて
$ npm i
$ node tools/build.js --target node javascript ruby
build/の中にrubyとjsだけでできてる
$ tree build/lib
code:結果
├── highlight.js
├── index.js
└── languages
├── javascript.js
└── ruby.js
いらない言語だけ削ってビルドする
$ ls src/languages | ruby -lane 'print $_.gsub(/\.js$/,"").gsub(/\r\n/,"") unless /^(yaml|x86asm|mathematica)\.js$/ =~ $_' | xargs -t node tools/build.js --target node
こうなる
$ node tools/build.js --target node 1c accesslog actionscript apache applescript arduino armasm asciidoc aspectj autohotkey autoit avrasm axapta bash basic bnf brainfuck cal capnproto ceylon clojure-repl clojure cmake coffeescript cos cpp crmsh crystal cs csp css d dart delphi diff django dns dockerfile dos dts dust elixir elm erb erlang-repl erlang fix fortran fsharp gams gauss gcode gherkin glsl go golo gradle groovy haml handlebars haskell haxe hsp htmlbars http inform7 ini irpf90 java javascript json julia kotlin lasso less lisp livecodeserver livescript lua makefile markdown matlab maxima mel mercury mipsasm mizar mojolicious monkey moonscript nginx nimrod nix nsis objectivec ocaml openscad oxygene parser3 perl pf php powershell processing profile prolog protobuf puppet purebasic python q qml r rib roboconf rsl ruby ruleslanguage rust scala scheme scilab scss smali smalltalk sml sqf sql stan stata step21 stylus swift taggerscript tcl tex thrift tp twig typescript vala vbnet vbscript-html vbscript verilog vhdl vim xl xml xquery zephir