简体   繁体   中英

node + express development workflow

One point I feel is missing in all blogs and tutorials about node + express development workflow I've read until now is this:

Which app should you have in your browser when developing:

  1. the source app, with pretty, not minified/uglifyed javascript, css, html,

    or

  2. the built app, with minified/uglifyed javascript (+ source maps), css, html, ie the app produced by gulp workflow (the code that eventually will be uploaded to production)

?

Asking the same thing with different words: in your express app, do you use
app.use(express.static(__dirname + '/app')); or
app.use(express.static(__dirname + '/dist')); ?

I currently adopt the point 1., but I suppose the point 2. should be the best choice... :-(

I've seen both practices in the field. Personally I recommend using the non-minified/uglifyed CSS and Javascript while writing (and debugging!) code. When the code goes in production, the build script should take care of minimizing and uglifying all resources.

Don't worry too much about bugs that could be introduced due to the minification/compression phase. If your build script is properly written and tested, it's very unlikely you'll ever see a bug pop up.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM