精简Mathjax


我用Mathjax 2.7,这个项目很庞大,比其前身jsMath文件多多了。 终于看到有两篇网文讲到其精简:《MathJax 瘦身记》《MathJax Grunt Cleaner (MathJax 的简化工具) 》。 自己做了一下,是这样的:

我先直接删掉了font/HTMLCSS/TeX/png。然后使用mathjax-grunt-cleaner,我的试验结果是:
Gruntfile.js:
  grunt.registerTask("default", [
    // **Notes** on the template. When instructions say "Pick one", this means commenting out one item (so that it"s not cleaned).
    //
    //      Early choices.
    "clean:unpacked",
    //"clean:packed", // pick one -- packed for production, unpacked for development.
    //"clean:allConfigs", // if you do not need any combined configuration files.
    //      Fonts. Pick at least one! Check notes above on configurations.
    "clean:fontAsana",
    "clean:fontGyrePagella",
    "clean:fontGyreTermes",
    "clean:fontLatinModern",
    "clean:fontNeoEuler",
    "clean:fontStix",
    "clean:fontStixWeb",
    //"clean:fontTeX",
    //      Font formats. Pick at least one (unless you use SVG output; then clean all).
    //"clean:dropFonts", // when using SVG output                //this is essential for math rendering effect
    "clean:eot",
    //"clean:otf",
    "clean:png",
    "clean:svg",
    "clean:woff",
    //      Input. Pick at least one.
    "clean:asciimathInput",
    "clean:mathmlInput",
    //"clean:texInput",
    //       Output
    //"clean:htmlCssOutput",
    "clean:mathmlOutput",
    "clean:svgOutput",
    // Extensions. You probably want to leave the set matching your choices.
    "clean:extensionsAsciimath",
    "clean:extensionsMathml",
    //"clean:extensionsTeX",
    //"clean:extensionHtmlCss",
    // Other items
    "clean:locales",                        //This reduces the file number largely
    "clean:miscConfig",
    //        "clean:miscExtensions", // you probably want that
    "clean:images",
    "clean:notcode"
  ]);

 

这样文件少多了,MathJax小多了。



Powered by