我找到了一個解決方案:遷移到Angular CLI。
此鏈接幫助我很多: http://www.codingpedia.org/ama/fast-faster-angular-cli-how-i-converted-my-angular-project-to-use-angular-cli
我在.angular.cli.json
增加一些線styles
和scripts
。我把我的app
參數:
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"app/api",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.scss",
"../src/assets/vendors/bootstrap/dist/css/bootstrap.min.css",
"../node_modules/font-awesome/css/font-awesome.css",
"../src/assets/vendors/iCheck/skins/flat/green.css",
"../src/assets/build/css/custom.min.css"
],
"scripts": [
"../src/assets/vendors/jquery/dist/jquery.min.js",
"../src/assets/vendors/bootstrap/dist/js/bootstrap.min.js",
"../src/assets/vendors/datatables.net/js/jquery.dataTables.min.js",
"../src/assets/vendors/datatables.net-bs/js/dataTables.bootstrap.min.js",
"../src/assets/vendors/datatables.net-buttons/js/dataTables.buttons.min.js",
"../src/assets/vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js",
"../src/assets/vendors/datatables.net-buttons/js/buttons.flash.min.js",
"../src/assets/vendors/datatables.net-buttons/js/buttons.html5.min.js",
"../src/assets/vendors/datatables.net-buttons/js/buttons.print.min.js",
"../src/assets/vendors/jszip/dist/jszip.min.js",
"../src/assets/vendors/pdfmake/build/pdfmake.min.js",
"../src/assets/vendors/pdfmake/build/vfs_fonts.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
]
我必須優化這一點,但它的工作現在。
如果您使用cli使用'ng build',您將獲得生產構建文件的文件夾dist。現在部署這些 –
如果您安裝了Angular CLI,那麼您可以使用「ng build」 – ramez
不,我沒有angular-cli。從QuickStart開始。 – Portekoi