docx转html

步骤

1.通过git 将代码拉取到本地

git clone https://github.com/mwilliamson/mammoth.js.git

2.打开(browser-demo)在这里插入图片描述

3.在控制台查看,发现没有这个文件在这里插入图片描述

4.查看makefile

.PHONY: test mammoth.browser.js npm-install

test:
	npm test

setup: npm-install mammoth.browser.min.js

npm-install:
	npm install

mammoth.browser.js:
	node_modules/.bin/browserify lib/index.js --standalone mammoth -p browserify-prepend-licenses > $@

mammoth.browser.min.js: mammoth.browser.js
	node_modules/.bin/uglifyjs mammoth.browser.js -c > $@

发现需要依赖来编译。

5.执行以下命令(这里node已经环境已经配好的)

npm install

发现有错误:在这里插入图片描述

这个make在windows下可以不用管,接下来执行:

node_modules/.bin/browserify lib/index.js --standalone mammoth -p browserify-prepend-licenses > mammoth.browser.js

如果这个没有问题,在执行这条命令:

node_modules/.bin/uglifyjs mammoth.browser.js -c > mammoth.browser.min.js

发现在vscode终端中报错:
在这里插入图片描述

解决办法:

重新通过git自带的bash(该答案来自于网络)来执行以下命令:

node_modules/.bin/browserify lib/index.js --standalone mammoth -p browserify-prepend-licenses > mammoth.browser.js
node_modules/.bin/uglifyjs mammoth.browser.js -c > mammoth.browser.min.js

最终结果如下:
在这里插入图片描述

6.查看生成的文件

在这里插入图片描述

7.查看结果
在这里插入图片描述

8.总结

node_modules/.bin/browserify lib/index.js --standalone mammoth -p browserify-prepend-licenses > mammoth.browser.js
node_modules/.bin/uglifyjs mammoth.browser.js -c > mammoth.browser.min.js 
# 如果是windows环境的话,这两条命令一定要在gitbash中执行,否则会编译失败的,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值