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

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:

主站蜘蛛池模板: 南平市| 晴隆县| 揭阳市| 肇庆市| 和平县| 铜鼓县| 平湖市| 土默特左旗| 溧阳市| 报价| 宁陵县| 宿迁市| 昌平区| 宜宾县| 阜宁县| 商都县| 天水市| 屯昌县| 灌云县| 土默特左旗| 太白县| 神池县| 安徽省| 甘泉县| 曲麻莱县| 沂源县| 许昌县| 波密县| 股票| 甘肃省| 稷山县| 寻甸| 绍兴市| 克山县| 平定县| 九台市| 汾西县| 靖宇县| 肇州县| 饶阳县| 宣化县|