Mibew源代码编译

测试Mibew源代码编译,发现需要下载很多东西 

源码地址

可以到https://github.com/Mibew/mibew 下载源码,下方有基本的编译说明

Mibew源代码编译_gulp

Build from sources

There are several actions one should do before use the latest version of Mibew from the repository:

  1. Obtain a copy of the repository using git clone, download button, or another way.
  2. Install node.js and npm.
  3. Install Gulp.
  4. Navigate to src/ directory of the local copy of the repository.
  5. Install npm dependencies using npm install.
  6. 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

Mibew源代码编译_gulp_02


开始测试

在尝试编译前,可以看看安装好的客户端调用了那些js

下载安装nodejs

https://nodejs.org/zh-cn/download

安装gulp

安装说明https://gulpjs.com/docs/en/getting-started/quick-start/

npm install --global gulp-cli

Mibew源代码编译_gulp_03

npm install --save-dev gulp

Mibew源代码编译_node.js_04

查看gulp 版本号

gulp --version

Mibew源代码编译_gulp_05


npm install

Mibew源代码编译_node.js_06

查看打包任务

gulp -T

可以看到在最底下确实有default 

Mibew源代码编译_gulp_07

查看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有错误

Mibew源代码编译_mibew_08

npm install gulp-xgettext --save-dev

缺少xgettext工具,需要去下载,还不能下载低版本的,低版本不支持javascript

Mibew源代码编译_node.js_09

这里尝试打包 chat-styles看一看啥情况

// Performs all job related to chat styles
gulp.task('chat-styles', gulp.series('chat-styles-handlebars', 'chat-styles-js'));

gulp chat-styles

 打包成功了

Mibew源代码编译_mibew_10

Mibew源代码编译_mibew_11

在打开客户接入时看到temmplates.js是有用到的

Mibew源代码编译_gulp_12

修改一下mibew-master\src\mibew\styles\chats\default\templates_src\client_side\chat\message_form.handlebars

重新打包gulp chat-styles确实能看到新增加的内容

Mibew源代码编译_node.js_13

这里能看到是编译打包成功一部分功能的

下载php

这里在windows下使用小皮面板phpstudy_pro来下载了

Mibew源代码编译_gulp_14

下载xgettext

windows下将xgettext\bin目录加入环境变量中

例:

Mibew源代码编译_gulp_15

https://www.gnu.org/software/gettext/

windows版本

Mibew源代码编译_node.js_16

https://mlocati.github.io/articles/gettext-iconv-windows.html

Mibew源代码编译_gulp_17

使用低版本xgettext出现问题现象,在有一个网站找到个0.18版本都是会报错

Mibew源代码编译_node.js_18

下载git

https://git-scm.com/download/win

windows下将git\bin目录加入环境变量中

Mibew源代码编译_mibew_19

这个git用浏览器下载不知道为啥特别慢,用迅雷等第三方下载工具特别快,神奇

在打包编译中会出现很多神奇问题,应该是墙的原因,试了好多次终于成功

Mibew源代码编译_mibew_20

Mibew源代码编译_node.js_21

使用了N多次 gulp default 终于编译打包出来我们想要的东西了

Mibew源代码编译_node.js_22

Mibew源代码编译_node.js_23