0

I'm new with Angular2. I've follow the quick start guide and create my application.

Now, I'm ready to push in production on my server. But I've many and many files.

I've found this SO : How to bundle an Angular app for production

But I do not understand. If I make a npm build, dist folder do not exist but no error happen.

If I try something with Gulp, I do not understand to. like here : http://blog.scottlogic.com/2015/12/24/creating-an-angular-2-build.html

If there an easy way to create release files in a folder and push it online without many many commands before?

11
  • 1
    if you are using cli use ng build you will get a folder dist with your production build files. Now deploy these Commented Aug 14, 2017 at 11:46
  • If you have Angular CLI installed, than you can use "ng build" Commented Aug 14, 2017 at 11:46
  • No I do not have angular-cli. Just start with QuickStart. Commented Aug 14, 2017 at 11:48
  • you need to use prod environment check github.com/angular/angular-cli/wiki/build for reference Commented Aug 14, 2017 at 11:53
  • 1
    Angular isn't a language, it is a framework library built on a scripting language (a language that is interpreted, not compiled). You can't compare the build process in Angular to the process in, say, a C# application..... Commented Aug 14, 2017 at 12:07

1 Answer 1

0

I've found a solution : migrate to Angular CLI.

This link help me a lot : http://www.codingpedia.org/ama/fast-faster-angular-cli-how-i-converted-my-angular-project-to-use-angular-cli

I add some lines in my .angular.cli.json for styles and scripts. I put my app parameters :

"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" } } ] 

I have to optimise this but it's working now.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.