an opinionated yeoman generator that scaffolds a mvc express webapp completely in es6
simply run the following to install via npm:
npm i -g yo gulp-cli bower generator-espress
once installed, simply do yo espress
, and you'll be on your way to building your next project!
all of your source code goes in the src
folder.
anything javascript can (and should) be written in es6.
the strucutre is as follows:
src
├── app.js // express app configuration (es6)
├── config.js // environment configuration (es6)
├── app
│ ├── controllers // express routes (es6)
│ ├── helpers // modules, middlewares (es6)
│ ├── models // mongoose models (es6)
│ └── views // jade templates (jade)
├── files // any files that need to be hosted, e.g. pdfs, text files, etc.
├── fonts // ttf fonts
├── images // source images
├── scripts // client-side javascript (es6)
└── styles // style sheets (sass)
running gulp build
will produce a new directory (build
by default) with a slightly different structure:
build
├── app.js // transpiled express configuration
├── config.js // transpiled environment configuration
├── app
│ ├── controllers // transpiled express routes
│ ├── helpers // transpiled modules, middlewares
│ ├── models // transpiled mongoose models
│ └── views // same files as source
└── static
├── css // actual css
├── files // same files as source
├── fonts // webfonts (eot, ttf, woff, woff2) and a font-face stylesheet
├── img // optimized images
└── js // transpiled client-side code
gulp
is the same as gulp serve
, which not only starts your express server, but also reloads it whenever server-side code changesgulp build
creates your production-ready webapp by running the following tasks:
images
to optimize imagesstyles
to compile sass, write sourcemaps, autoprefix, and minifyscripts
togulp lint
will lint all javascript with eslint and rules definted in .eslint.json
gulp clean
will remove any and all files created by any of the above tasksgulp build:client
will only run the tasks related to the client (images
, styles
, scripts
, files
, fonts
, bower
)gulp transpile:controllers
will transpile only the controllersgulp lint:models
will lint only the modelsgulp tasks
will show you all of the available tasks