AngularJS - Grunt: is there a solution to build a working app with only desired modules

I am working on refactoring an application and I want to follow John Papa's guidelines as I found them very interesting and useful in my case: John Folder Guides - Application Structure

So I come to the part where I decided to split my application into different modules corresponding to these functions. Let's say one module for the accounts function, one for the transfer function, and one for the custom settings function.

I can do it well according to John Papa's recommendations: one application module and three other modules (account-module.js, transfer-module.js and user-settings-module.js) and their corresponding navigation (states - config.js etc.).

Hope I was clear enough because now comes the tricky part: D

The idea I have is that I would like to create two (or more) different applications depending on what I want. For example, I would like to create an application without a mediation module and do it during my grunt process (by config).

I am currently using include_source grunt and grunt_war later, but there is no longer an option in the context of the "angular module" instead of using a regex to specify which files I need. These tasks prevent us from saying "Ok, I would like to package this, this and this module", for example (that would be fantastic!)

I think large applications must have faced this problem, because when they do not provide all business modules to every client, but make it customizable (at least I hope they are).

The question is how? Do they do it? Is this by hand (no point) or did they write some custom grunt task (gulp) or some custom scripts for this purpose?


Bonus question: Imagine that we are living in a dream world and there is a daunting challenge for that. My next question will be how to manage it in my app to customize my navigation, for example (there is no more navigation button in the menu). I think that if the grunt task and the application are using the same config file, this won't be a problem and I can use the grunt-angular-settings task to have a constant in my application.

Thank you for your attention and I am very curious to read you :)

Regards, Yassine GAYL

+3


source to share


1 answer


interesting. see how he angular.js

creates artifacts himself . in the src code, it has a bunch of modules scattered in different folders. it introduces lib/grunt/utils

and lib/grunt/plugins

to handle the build process, say which modules should go into which target file. you may have interests to try the same, good luck with it.




https://github.com/angular/angular.js/blob/master/Gruntfile.js#L166

0


source







All Articles