const regex = /```[\S\s]*?```/g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('```[\\S\\s]*?```', 'g')
const str = `## 使用指南 (Usage)
**下载使用**
\`\`\`js
git clone https://github.com/BiYuqi/webpack-seed.git
cd webpack-seed
npm install
\`\`\`
**本地开发(dev)**
\`\`\`js
npm run dev
\`\`\`
**打包(build)**
* 默认情况下,该配置方案假设你的应用是被部署在一个域名的根路径上例如 https://www.my-app.com/
* 如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径
* 例如,如果你的应用被部署在 https://www.my-app.com/my-app/
* 则设置 webpack的output.publicPath 为 /my-app/
* 本项目由于需要临时部署在git-pages预览 所以改配置临时改为/webpack-seed/
* 普通打包(大部分) npm run build 默认 '/'
* 该命令具体请看package.json scripts命令配置
* [配置详情](https://github.com/BiYuqi/webpack-seed/blob/master/webpack.seed.common.js#L13)
* [scripts命令配置](https://github.com/BiYuqi/webpack-seed/blob/master/package.json#L8)
\`\`\`js
// 普通打包(大部分) npm run build publicPath默认 '/'
npm run build
// 打包时 npm run build:git 该命令会打包的路径会自动带上github项目地址/webpack-seed/
//(当发布环境不是服务器根路径,都可以采用该方案,只需更改路径名称即可,本项目二级路径为webpack-seed)
npm run build:git
\`\`\`
**依赖分析**
\`\`\`js
// 利用webpack-bundle-analyzer 进行代码构建分析
npm run analyzer
\`\`\`
**测试**
\`\`\`js
// karma mocha chai
npm run test
\`\`\`
## 开发规范 (Standard)
查看[INSTRODUCTION](https://github.com/BiYuqi/webpack-seed/blob/master/INSTRODUCTION.md)
## 接口配置 (Api Setting)
查看[API/README](https://github.com/BiYuqi/webpack-seed/blob/master/src/api/README.md)
## 目录结构 (Source)
查看[INSTRODUCTION](https://github.com/BiYuqi/webpack-seed/blob/master/INSTRODUCTION.md#%E7%9B%AE%E5%BD%95%E7%BB%93%E6%9E%84-source)
## 输出目录 (Output)
[查看输出](https://github.com/BiYuqi/webpack-seed/tree/gh-pages)
* dist/
* ---html
* ---image
* ---media
* ---css
* ---js
* ---lib
* ---index.html
> 注意:如果有音视频等,会被打包在media目录
## TODO
- [x] 添加ejs模板,进行页面(首尾)复用, 页面功能模板渲染
- [x] mini-css-extract-plugin 提取js内引入scss文件失败, 打包后依然在js文件(已解决)
- [x] 首页页面模板未完成(单独处理打包)
- [x] 添加第三方库以链接的方式引入
- [x] 增加ESLint代码校验
- [x] 增加两个文件夹,一个是fix IE兼容, 一个是引入的公用库,自动加载第三方库到页面,避免手动填写
- [x] 增加网站未登录的模板(无header,footer)
- [x] 添加多样化layout模板支持(示例layout/layoutAuth)
- [x] 搭建单元测试环境(基于karma mocha chai)
- [x] 单独抽离配置文件webpack.seed.common.js
- [ ] 待完善测试用例编写
- [ ] 添加doc使用说明以及实现思路解析
## DOING
- [ ] 添加doc使用说明以及实现思路解析
## LONG TODO(Base on master)
- [ ] 搭建国际化版本
- [ ] 建立分支web-system (后台管理系统模板)
- [ ] 添加完整网站demo示例
- [ ] 大众网站模板
- [ ] web-mobile(移动端模板)
## 更新日志 (Update log)
查看[CHANGELOG](https://github.com/BiYuqi/webpack-seed/blob/master/CHANGELOG.md)
> 本项目目前接口(使用axios只能支持到IE10+), 项目本身支持IE9+
## 贡献代码
* 先 Fork (https://github.com/BiYuqi/webpack-seed/fork)
* 创建分支 (git checkout -b your-idea)
* 提交更改 (git commit -am 'Fixed something')
* 推送更改 (git push origin your-idea)
* 创建一个 Pull Request
> [Pull Request使用](http://www.ruanyifeng.com/blog/2017/07/pull_request.html)
## 参考(Thanks)
本脚手架开发中,ejs模板渲染实现这块参考了[webpack-seed](https://github.com/Array-Huang/webpack-seed), 特此备注`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions