Reputation: 7215
I have feature modules in my angular application and am looking for a way to create builds that only include certain features.
For example:
/app
|
|--/components
|
|--/core
|
|--/dataservices
|
|--/features
|
|--/customers
|
|--/orders
So say I wanted to produce a build that only included the orders module, are there any tools out there that can help in achieving this?
I am using gulp, and wondered about being able to configure a gulp task that took in some arguments where you specify what modules to include and then use file globbing patterns or similar to target certain folders/files in the build.
Can anyone offer any suggestions\approaches?
Thanks
Upvotes: 1
Views: 25
Reputation: 573
Yes, let's say you wanted a gulp task that globs all js in your orders folder and sub folders. A gulp task could looks like the following
// Gulp Orders Task
gulp.task('orders', function() {
return gulp.src('features/orders/**/**.js')
.pipe(concat('orders.js'))
.pipe(gulp.dest('app/build/js'))
.pipe(browserSync.reload({
stream: true
}));
});
What this task does is globs all js, concatenates your js into one orders.js file into a new folder called build. It's also smart to use browserync to reload the page during development when js files change.
Your orders specific js would end up being app/build/js/orders.js
.
The variables you would need are
var concat = require('gulp-concat');
var browserSync = require('browser-sync').create();
Upvotes: 1