Reputation: 296
I'm from an Actionscript background. In Actionscript, if the main.as class import files from classA.as and classB.as then the compilation will only include main/classA/classB not classC codes.
I found it's harder to achieve with typescript. I've been developing re-useable javascript libraries along many projects. I have a folder structure of
scripts/com/libraries/service
scripts/com/libraries/components
scripts/com/projectA/files (my current project goes here)
In my main ts class, I have imported modules from /service but not /components. Is there a way I can compile only 'projectA' and 'service' codes and concat them into a big app.js file? (to achieve this i'm now manually added all classes needed in a gruntfile then concat them but I hope there's a smarter way!)
Thanks, Mars
Upvotes: 0
Views: 259
Reputation: 276313
I suppose you are using AMD? If so you can specify your main application entry point inside projectA to r.js ------- r.js is clever enough to only include files you actually reference using dependency tracing
To learn more about AMD: http://www.youtube.com/watch?v=4AGQpv0MKsA
To learn more about r.js : http://requirejs.org/docs/optimization.html
Upvotes: 1