当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript gulp-template类代码示例

本文整理汇总了TypeScript中gulp-template的典型用法代码示例。如果您正苦于以下问题:TypeScript gulp-template类的具体用法?TypeScript gulp-template怎么用?TypeScript gulp-template使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了gulp-template类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Date

        inquirer.prompt(prompts).then(answers => {
            if (!answers.moveon) {
                return;
            }

            let today = new Date(),
                year = today.getFullYear().toString();

            answers.appVersion = [
                'v0',
                year.slice(2),
                (today.getMonth() + 1) + padLeft(today.getDate())
            ].join('.');
            answers.appNameSlug = _.slugify(answers.appName);
            answers.appTitle = startCase(answers.appName).split(' ').join('');
            answers.appYear = year;

            gulp.src([
                `${__dirname}/../templates/common/**`,
                `${__dirname}/../templates/${answers.projectType}-package/**`
            ])
                .pipe(template(answers))
                .pipe(rename(file => {
                    if (file.basename[0] === '_') {
                        file.basename = '.' + file.basename.slice(1);
                    }
                }))
                .pipe(conflict('./'))
                .pipe(gulp.dest('./'))
                .on('end', () => {
                    this.log.info(`Successfully created LabShare ${answers.projectType} package...`);
                });
        });
开发者ID:LabShare,项目名称:lsc,代码行数:33,代码来源:package.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:

gulp.task('build.sass', done => {
  const app_cdn = argv.deployUrl ? argv.deployUrl: '';
  gulp.src(join('./src', '**', '*.scss'))
    .pipe(cssGlobbing({  extensions: ['.scss'] }))
    .pipe(sass({
      includePaths:[join('./src', 'stylesheets')],
      style: 'compressed'
    }).on('error', sass.logError))
    .pipe(autoprefixer(AUTOPREFIXER_BROWSERS))
    .pipe(template({
      'APP_CDN': app_cdn,
    }))
    .pipe(gulp.dest('./.styles'))
    .on('end', () => {
      gulp.src('./.styles/stylesheets/main.css')
        .pipe(gulp.dest('./src'))
        .on('end', done);
    });
});
开发者ID:iamthelogik83,项目名称:front,代码行数:19,代码来源:gulpfile.ts

示例5: 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-template类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。