在angularJS应用程序构建中包含某些模块

时间:2016-07-11 14:35:19

标签: angularjs build gulp

我的角度应用程序中有功能模块,我正在寻找一种方法来创建仅包含某些功能的构建。

例如:

[AssemblyInitialize]
public static void AssemblyInitialize(TestContext context)
{
    AppDomain currentDomain = AppDomain.CurrentDomain;
    currentDomain.UnhandledException += currentDomain_UnhandledException;       
}

static void currentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
    Exception ex = e.ExceptionObject as Exception;
    if (ex != null)
        Trace.WriteLine(ex);

        Assert.Fail("Unhandled Exception in thread.");
}

所以说我想生产一个只包含订单模块的构建,那里有什么工具可以帮助实现这个目标吗?

我正在使用gulp,并且想知道能够配置一个gulp任务,该任务接受了一些参数,你指定要包含哪些模块,然后使用文件globbing模式或类似的目标来定位构建中的某些文件夹/文件。

任何人都可以提供任何建议\方法吗?

由于

1 个答案:

答案 0 :(得分:1)

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();