我正在尝试将mathjax运行到我的ionic2应用程序中。有人可以告诉我如何使用mathjax-grunt-cleaner来减少mathjax的大小吗?
到目前为止,我已经使用NPM + donwload mathjax最新安装grunt +从github下载MathJax-grunt-cleaner。
之后需要帮助。
答案 0 :(得分:0)
我需要MathJax用于我的Ionic 2应用程序,我遵循相同的程序(grunt-cleaner)。您可以下载已调整大小的mathjax文件夹here 要将其包含在您的项目中:
www
文件夹中。head
部分: <script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$$','$$'],['$','$'], ['\(','\)']]}});
</script>
<script type="text/javascript" src="mathjax/MathJax.js?config=default">
</script>
答案 1 :(得分:0)
我不是Grunt或MatJax的专业人士,但它对我这样工作
// download and extract mathjax
curl -J -O https://codeload.github.com/mathjax/MathJax/zip/2.7.8
unzip MathJax-2.7.8.zip
rm MathJax-2.7.8.zip
cd MathJax-2.7.8
// download the grunt file
curl -J -O https://raw.githubusercontent.com/mathjax/MathJax-grunt-cleaner/master/Gruntfile.js
// install grunt
npm install -g grunt-cli
npm install grunt grunt-contrib-clean grunt-regex-replace --save-dev
// in Gruntfile.js edit the "template" job, or copy it, we wanted to use only html-formulars so i commented out (to keep it)
//"clean:packed"
//"clean:fontTeX"
//"clean:woff"
//"clean:texInput"
//"clean:htmlCssOutput"
//"clean:extensionsTeX"
//"clean:extensionHtmlCss"
//"clean:allConfigs"
//"clean:dropFonts"
It looks like that now:
grunt.registerTask("template", [
// **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
"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",
"clean:miscConfig",
// "clean:miscExtensions", // you probably want that
"clean:images",
"clean:notcode"
]);
// then run grunt job
grunt template
// clean up
rm -rf node_modules
rm Gruntfile.js
rm package-lock.json