# express-generator **Repository Path**: d7c/express-generator ## Basic Information - **Project Name**: express-generator - **Description**: express-generator 使用案例。 - **Primary Language**: NodeJS - **License**: AGPL-3.0 - **Default Branch**: master - **Homepage**: http://www.d7c.top/ - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2022-09-21 - **Last Updated**: 2023-10-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # express-generator ## 介绍 express-generator 使用案例。 ## 软件架构 ### express-generator express-generator 应用生成器工具可以用来快速创建一个应用的骨架,[express-generator 文档](https://www.expressjs.com.cn/starter/generator.html)。 ### 模板引擎 #### dust [dust 官网](http://www.dustjs.com/),[dust GitHub](https://github.com/linkedin/dustjs),[dust 语法](https://github.com/linkedin/dustjs/wiki/Dust-Inner-Workings)。 #### ejs [ejs 官网](https://ejs.bootcss.com/)。 #### hbs [hbs 官网](https://github.com/pillarjs/hbs)。 #### hjs [hjs GitHub](https://github.com/nullfirm/hjs),[hjs npm](https://www.npmjs.com/package/hjs)。 #### jade [jade 官网](https://jade-lang.com/),[jade GitHub](https://github.com/pugjs/pug)。 #### pug 原 jade 引擎,[pug 官网](https://www.pugjs.cn/api/getting-started.html),[pug GitHub](https://github.com/pugjs/pug)。 #### twig [twig 官网](https://twig.symfony.com/)。 #### vash [vash GitHub](https://github.com/kirbysayshi/vash),[vash npm](https://www.npmjs.com/package/vash)。 ## 安装教程 ### 安装 npm install -g express-generator ``` npm install -g express-generator ``` ### express-generator 命令介绍 ``` E:\Trash\express>express -h Usage: express [options] [dir] Options: --version output the version number 输出版本号 -e, --ejs add ejs engine support 添加支持的视图引擎 --pug add pug engine support --hbs add handlebars engine support -H, --hogan add hogan.js engine support -v, --view add view support (dust|ejs|hbs|hjs|jade|pug|twig|vash) (defaults to jade) 添加视图引擎,默认是 jade --no-view use static html instead of view engine 创建不带视图引擎的项目 -c, --css add stylesheet support (less|stylus|compass|sass) (defaults to plain css) 样式引擎,默认是 css --git add .gitignore 生成一个带 .gitignore 忽略文件的项目 express --git -f, --force force on non-empty directory 可以在一个非空目录下创建项目并保留目录下的文件 express -f -h, --help output usage information 帮助命令 ``` ## 使用案例 ### ejs&less ``` 在当前目录下生成 ejs-less 项目: express --view=ejs --css=less --force --git ejs-less 项目结构: |-- ejs-less |-- bin 启动脚本目录 |-- public 静态资源目录 |-- routes 路由文件目录 |-- views 模板文件目录 |-- app.js 入口脚本 |-- package.json 安装项目: cd ejs-less npm install 在 MacOS 或 Linux 中,通过如下命令启动此应用: DEBUG=ejs-less:* npm start 在 Windows 命令行中,使用如下命令: set DEBUG=ejs-less:* & npm start 在 Windows 的 PowerShell 中,使用如下命令: $env:DEBUG='ejs-less:*'; npm start 浏览器访问地址: http://localhost:3000/ ``` ## 捐助打赏 如果您觉得我们的开源软件对你有所帮助,请扫下方二维码打赏我们一杯咖啡。 ![微信收款码](https://images.gitee.com/uploads/images/2021/0222/174352_b22739f5_1070311.jpeg "微信收款码.jpg") ![微信赞赏码](https://images.gitee.com/uploads/images/2021/0222/174521_67e18b39_1070311.jpeg "微信赞赏码.jpg") ![支付宝收款码](https://images.gitee.com/uploads/images/2021/0222/174540_94a9ac41_1070311.jpeg "支付宝收款码.jpg") ## 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request ## 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)