Skip to content

🚚 Express dev hot reloading when modifying the files using browser-sync and gulp.

Notifications You must be signed in to change notification settings

ycjcl868/Express_Gulp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

原来用的React+Webpack时,体验到那种同步压缩修改的快感。这次使用Express时,也想达到那种效果,一番折腾后,于是有了下图,项目地址:https://github.com/ycjcl868/Express_Gulp

目的

我使用Express+Ejs+Less开发,想开发时对所有资源进行压缩同步到浏览器端,Google搜索一遍,都不是太符合我的项目要求。于是看着Gulp文档结合npmjs.com终于折腾完毕。

Quickstart

安装

clone项目

$ git clone https://github.com/ycjcl868/Express_Gulp.git

切换目录,安装依赖

$ cd Express_Gulp && npm install

使用

开发模式,具备热更新,边修改浏览器边刷新,dev 端口 7000,配置项端口为 3001

$ npm run dev

构建项目,将文件压缩、打包、编译,输出 dist 目录

$ npm run build

生产模式,不具备热更新,运行在 3000 端口

$ npm run start

配置

下面说下我的配置方法:

我的目录结构:

├── app.js   # Express Server
├── bin
│   └── www  # 启动Server
├── dist     # 编译压缩目录(部署目录)
│   ├── css
│   ├── img
│   ├── js
│   ├── views
│   └── lib  # 第三方库目录(bower安装)
├── .bowerrc # bower前端安装库
├── gulpfile.js  # Gulp配置文件
├── package.json
├── public       # 开发目录
│   ├── img
│   ├── js
│   └── less
├── routes
│   ├── index.js
│   └── users.js
└── views      # html
    ├── error.ejs
    └── index.ejs

About

🚚 Express dev hot reloading when modifying the files using browser-sync and gulp.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages