angularjsionic-frameworkautomationbowergulp-inject

Automatically add js/css files to ionic projects


I want to automate the injection of new js/css files to my ionic project. So, I found this really useful article, which shows how to do it using gulp inject, but just with my own js/css files (those in js/css folders).

If I now install another external library using bower, for example:

bower install angular-google-maps --save

That library is not automatically injected, because it's installed in lib folder, outside js folder, as it's a library from an external vendor.

I guess I should have another gulp task to minimize the external libraries installed with bower, and put them into js folder to make them injectable. Am I right?


Solution

  • Yes, you are right.
    Quoting your article:

    There is all of kinds of additional functionality that you can perform with gulp such as minifying of css and javascript files, running npm/bower commands, or running sass compile commands. The gulp-inject is just one module.

    You can use a module like main-bower-files to retrieve these files and do whatever you want with them.
    You can also have a look at this answer to get a starting point.