admin管理员组文章数量:1402596
I am looking for a way to include momentjs with a localization (german in my case), but not with all other localizations (the 40kb minified version), to keep it slim. Is it possible to exclude all other localizations but one specific?
I am looking for a way to include momentjs with a localization (german in my case), but not with all other localizations (the 40kb minified version), to keep it slim. Is it possible to exclude all other localizations but one specific?
Share Improve this question asked Dec 28, 2014 at 15:40 ClawishClawish 2,9643 gold badges25 silver badges28 bronze badges1 Answer
Reset to default 8According to moment.js
docs : Loading locales in the browser just requires you to include the locale files.
<script src="moment.js"></script>
<script src="locale/fr.js"></script>
<script src="locale/pt.js"></script>
<script>
moment.locale('fr'); // Set the default/global locale
// ...
</script>
Also if you desire, you can build a minified moment.js version bundled with the locale of your choice.
grunt embedLocales --embedLocales de
Update:
As mentioned in ments and according to the contribution guide running this mand :
grunt transpile:fr,ru
Will result in custom locale bundles moment-with-locales.custom.js
and locales.custom.js
inside build/umd/min
containing just French and Russian.
本文标签: javascriptMomentjs only certain localizationsStack Overflow
版权声明:本文标题:javascript - Moment.js: only certain localizations - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744322080a2600551.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论