官术网_书友最值得收藏!

Building our application

Now is the time to deploy our application, but before we do this, we need to compress and minify our Aurelia code. Aurelia CLI provides us with the build option to generate these ready-to-deploy files that contain all our application code.

As you might want to build your application for different environments (dev, stage, or prod), this build option comes along with the --env flag. For example, execute the following command in your project:

au build --env prod

The following is a sample output of my-app project:

As the output shows, there are two main files generated: app-bundle.js, which contains our application logic and vendor-bundle.js, which contains third-party dependencies. These two files are generated into the scripts folder in our root application folder.

If you want to run your application and check whether everything is okay with the bundles you recently created, let's install the http-server module using npm. Run the following command in your Terminal:

npm install -g http-server

Now, create a dist folder in your application root folder and copy the index.html page and the scripts folder that contain our bundles.

For the last step, get into the dist folder in your Terminal and run the following command:

cd dist
http-server

Use the cd command to navigate across your folders in your Terminal.

This command will expose some four URLs where the web server is running; copy the first URL and open it on your web browser, and you should see your application up and running:

主站蜘蛛池模板: 临潭县| 泊头市| 沙坪坝区| 望江县| 萝北县| 太仆寺旗| 明溪县| 襄汾县| 阿拉尔市| 大关县| 满洲里市| 蓬安县| 锡林郭勒盟| 长治市| 杂多县| 邹平县| 浮山县| 新野县| 长白| 淄博市| 哈密市| 宝丰县| 洛隆县| 西乌珠穆沁旗| 武山县| 娄烦县| 天镇县| 应用必备| 上犹县| 昭平县| 淮南市| 韶山市| 凤山县| 莒南县| 东平县| 天台县| 确山县| 义马市| 新余市| 烟台市| 大同县|