Mibew源代码编译
测试Mibew源代码编译,发现需要下载很多东西
源码地址
可以到https://github.com/Mibew/mibew 下载源码,下方有基本的编译说明
Build from sources
There are several actions one should do before use the latest version of Mibew from the repository:
- Obtain a copy of the repository using
git clone
, download button, or another way. - Install node.js and npm.
- Install Gulp.
- Navigate to
src/
directory of the local copy of the repository. - Install npm dependencies using
npm install
. - Run Gulp to build Mibew using
gulp default
.
Finally .tar.gz
and .zip
archives of the ready-to-use Mibew will be available in src/release
directory.
通过阅读我们知道需要
1.下载源码
2.安装node.js及npm
3.安装Gulp
4.切换到src目录下
5.npm install 安装下载相关js库
6.gulp defual 进行任务打包,注意这一个任务
官网上的文档说明
这里也有一个编译说明,和下载地址的并不多,多了一个php的安装,说明要详细一些
https://docs.mibew.org/development/build-system.html
开始测试
在尝试编译前,可以看看安装好的客户端调用了那些js
下载安装nodejs
https://nodejs.org/zh-cn/download
安装gulp
安装说明https://gulpjs.com/docs/en/getting-started/quick-start/
npm install --global gulp-cli
npm install --save-dev gulp
查看gulp 版本号
gulp --version
npm install
查看打包任务
gulp -T
可以看到在最底下确实有default
查看src/gulpfile.js,这个default包好多个任务的
gulp.task('default', function(callback) {
runSequence(
'clean',
['js', 'chat-styles', 'page-styles', 'generate-tmp-po'],
'pack-sources',
['post-pack-cleanup', 'clean-tmp-po'],
callback
);
});
gulp default 有报错,没有打包成功,应该是gulp-xgettext有错误
npm install gulp-xgettext --save-dev
缺少xgettext工具,需要去下载,还不能下载低版本的,低版本不支持javascript
这里尝试打包 chat-styles看一看啥情况
// Performs all job related to chat styles
gulp.task('chat-styles', gulp.series('chat-styles-handlebars', 'chat-styles-js'));
gulp chat-styles
打包成功了
在打开客户接入时看到temmplates.js是有用到的
修改一下mibew-master\src\mibew\styles\chats\default\templates_src\client_side\chat\message_form.handlebars
重新打包gulp chat-styles确实能看到新增加的内容
这里能看到是编译打包成功一部分功能的
下载php
这里在windows下使用小皮面板phpstudy_pro来下载了
下载xgettext
windows下将xgettext\bin目录加入环境变量中
例:
https://www.gnu.org/software/gettext/
windows版本
https://mlocati.github.io/articles/gettext-iconv-windows.html
使用低版本xgettext出现问题现象,在有一个网站找到个0.18版本都是会报错
下载git
https://git-scm.com/download/win
windows下将git\bin目录加入环境变量中
这个git用浏览器下载不知道为啥特别慢,用迅雷等第三方下载工具特别快,神奇
在打包编译中会出现很多神奇问题,应该是墙的原因,试了好多次终于成功
使用了N多次 gulp default 终于编译打包出来我们想要的东西了