當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript gulp-inject類代碼示例

本文整理匯總了TypeScript中gulp-inject的典型用法代碼示例。如果您正苦於以下問題:TypeScript gulp-inject類的具體用法?TypeScript gulp-inject怎麽用?TypeScript gulp-inject使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了gulp-inject類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: buildInjectable

gulp.task('index.build', () => {

  const JSLIB_INJECTABLES_TARGET = buildInjectable(PATH.src.jslib);
  const CSSLIB_INJECTABLES_TARGET = buildInjectable(PATH.src.csslib);
  const CSS = gulp.src(PATH.src.css, { read: false })
    .pipe(rename(function(filepath: any) {
      filepath.extname = '.css';
    }));

  return gulp.src(PATH.src.index)
    .pipe(inject(CSSLIB_INJECTABLES_TARGET, {
      name: 'csslib',
      transform: function(filepath: string) {
        arguments[0] = transformPath(filepath, 'lib');
        return inject.transform.apply(inject.transform, arguments);
      }
    }))
    .pipe(inject(JSLIB_INJECTABLES_TARGET, {
      name: 'jslib',
      transform: function(filepath: string) {
        arguments[0] = transformPath(filepath, 'lib');
        return inject.transform.apply(inject.transform, arguments);
      }
    }))
    .pipe(inject(CSS, {
      transform: function(filepath: string) {
        arguments[0] = filepath.replace(`/${PATH.src.base}/`, '');
        return inject.transform.apply(inject.transform, arguments);
      }
    }))
    .pipe(template(templateLocals))
    .pipe(gulp.dest(PATH.dest.app.base));
});
開發者ID:australdev,項目名稱:app,代碼行數:33,代碼來源:gulpfile.ts

示例2:

gulp.task("inject:transform", () => {
    gulp.src(["files.json"])
        .pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css", "src/**/*.html"], { read: false }), {
            starttag: "\"{{ext}}\": [",
            endtag: "]",
            transform: (filepath, file, i, length) => {
                return "  \"" + filepath + "\"" + (i + 1 < length ? "," : "");
            }
        }))
        .pipe(gulp.dest("build"));
});
開發者ID:AbraaoAlves,項目名稱:DefinitelyTyped,代碼行數:11,代碼來源:gulp-inject-tests.ts

示例3: function

gulp.task('index', () => {
  const libs: string[] = PATHS.src.vendor.css.concat(PATHS.src.vendor.js);
  const libStream = gulp.src(libs, { read: false });
  return gulp.src(PATHS.src.custom.index)
    .pipe(template({ APP_ROOT, IS_PROD }))
    .pipe(inject(libStream, {
      name: 'lib',
      transform: function(filePath) {
        arguments[0] = filePath.replace(FIRST_PATH_SEGMENT, '/lib');
        return inject.transform.apply(inject.transform, arguments);
      }
    }))
    .pipe(gulp.dest(PATHS.dest.dist.base));
});
開發者ID:JayKan,項目名稱:angular2-change-detection,代碼行數:14,代碼來源:gulpfile.ts

示例4: transformPath

gulp.task('index.build', () => {

  const rDistPath = new RegExp(`^/${PATH.dest.app.base}`);

  function transformPath(filepath: string): string {
    arguments[0] = filepath.replace(rDistPath, '');
    return inject.transform.apply(inject.transform, arguments);
  }

  function mapPath(dep: any): string {
    return `${dep.dest}/${dep.src.split('/').pop()}`;
  }

  const injectablesDependenciesRef = PATH.src.deps
      .filter(dep => dep['inject'])
      .map(mapPath);

  return gulp.src(PATH.src.index)
    .pipe(inject(gulp.src(injectablesDependenciesRef, {read: false}), {
      transform: transformPath
    }))
    .pipe(template(templateLocals))
    .pipe(gulp.dest(PATH.dest.app.base));
});
開發者ID:kgeorgieva,項目名稱:kristina-georgieva-angular2-site,代碼行數:24,代碼來源:gulpfile.ts


注:本文中的gulp-inject類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。