angular-cli have scripts array be bundled after the app module files
I followed this guide to add external scripts to an angular project.
However, I would like the scripts in the
scripts array to be bundled after the main bundle. Is this possible ?
See also questions close to this topic
I can not install Angulr-cli in windows 10
I'm doing a course to learn Angular, I've been trying to install angular-cli for 2 days, I've tried various solutions that I read about, but I always get the same mistakes.
I'm on windows 10, node -v 6.9.1, npm -v 3.10.8
After reading, I said to change the version of node from 8 to 6. After installation I went to see the folder located in C: \ Users \ Aurora \ AppData \ Roaming \ npm and that'sis empty, is there any mistake?
Thanks for your answers guys.
Initially I had installed the latest version of node, but in the forum of the course I'm following have suggested to upgrade to version 6.9.1 to not have problems with the installation of angular-cli.
So I uninstalled the node, deleted the related folders and reinstalled everything, I tried again but nothing has changed.
The folder located in C: \ Users \ Aurora \ AppData \ Roaming \ npm was empty, now I installed node_modules, typing in the cmd "npm install -g npm" and inserted in the system variable path "C: \ Users \ Aurora \ AppData \ Roaming \ npm ".
I just tried again and it seems that angular-cli has been installed, it gives me these 3 errors:
CSS optimization post processing using Angular-CLI
I am working on a angular project and the cli does a lot of cool optimizations for production build like minifications, but is there a way to optimize css to use dynamic shorter codes for css class names. I have searched a lot but didn't find anything for this specific use case. I found about css-loader but I am not sure on how to use it with angular-cli.
This is what I want the build process to achieve:
Angular CLI two bundles (one for prod, second for dev)
After ng build I get bundle files in /dist folder which I dynamically load in php file like this:
var inline = document.createElement('script'); var polyfills = document.createElement('script'); var styles = document.createElement('script'); var vendor = document.createElement('script'); var main = document.createElement('script'); inline.async = false; polyfills.async = false; styles.async = false; vendor.async = false; main.async = false; inline.src = ./dist/inline.bundle.js"; polyfills.src = ./dist/polyfills.bundle.js"; styles.src = ./dist/styles.bundle.js"; vendor.src = ./dist/vendor.bundle.js"; main.src = ./dist/main.bundle.js"; document.head.appendChild(inline); document.head.appendChild(polyfills); document.head.appendChild(styles); document.head.appendChild(vendor); document.head.appendChild(main);
but if I use ng build --prod my dev bundles are removed and replaced by other one. Is there some option to keep two types of bundles, for an instance one folder - /dist_prod with running ng build --prod command and second is /dist for dev version?