How to use one package manager for backend and frontend? (Yarn/NPM)

会有一股神秘感。 提交于 2019-12-04 13:38:57

The norm pretty much is something like:

  1. Install packages via yarn
  2. Use a task runner such as gulp, or module loader & bundler such as webpack to create the bundles you need.
    • This all depends on your stack, there are obviously others, for example in the past I've used .NET's native bundling, which you can achieve the same as gulp/webpack... again this is for you to decide.

The gist of it is, install all the modules in a central place (using a package manager), then have a loader or other process grab and move the required assets to the location that you need to use them.

I'd suggest having a look at a kickstart project (pertaining to the stack that you're using) eg: I've used : Fountainjs in the past with success, or look into Yeoman if fountain doesnt strike your fancy (fyi. Fountain is built on top of Yeoman)

In pseudo commands:

1. yarn install     /// installs all assets
2. gulp build       /// cleans out current public folder, bundles & copies new
3. gulp serve       /// runs your app
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!