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


TypeScript gulp-replace.default方法代码示例

本文整理汇总了TypeScript中gulp-replace.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript gulp-replace.default方法的具体用法?TypeScript gulp-replace.default怎么用?TypeScript gulp-replace.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gulp-replace的用法示例。


在下文中一共展示了gulp-replace.default方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

export default async function (env: string, target: string, callback?: Function) {
  await buildBundle(env, target)

  const config = require(`../../config/${env}.json`)
  const cdnPrefix = `https://dn-st.teambition.net/${config.cdnNames[target]}`
  const revall = new RevAll({
    prefix: cdnPrefix,
    dontGlobal: [/\/favicon\.ico$/],
    dontRenameFile: [/\.html$/],
    dontUpdateReference: [/\.html$/],
    dontSearchFile: [/lib.js/, /images/]
  })

  const stream = merge2([
    gulp.src([
      `www/index.html`,
      `www/fonts/**`,
      `www/images/**`
    ]),
    gulp.src([
      `www/js/**`
    ])
      .pipe(stripDebug())
      .pipe(uglify())
      .pipe(greplace('/weixin/dev/signature', '/weixin/signature'))
      .pipe(greplace('/weixin/dev/tpl/message', '/weixin/tpl/message'))
      .pipe(greplace('http://"+window.location.host+"/images/teambition.png', '/images/teambition.png'))
      .pipe(greplace('/weixin/dev/', '/weixin/')),
    gulp.src([
      `www/css/**`
    ]).pipe(cssNano({rebase: false})),
  ])
    .pipe(revall.revision())
    .pipe(gulp.dest(`dist`), callback)

  return new Promise((resolve, reject) => {
    stream.on('end', async function() {
      resolve()
    })
  })
}
开发者ID:jianxc,项目名称:teambition-mobile-web,代码行数:41,代码来源:release.ts

示例2:

 keys.forEach((key) => {
   if (typeof envConfig[key] === 'string') {
     source.pipe(greplace(defaultConfig[key], envConfig[key]))
   }
 })
开发者ID:jianxc,项目名称:teambition-mobile-web,代码行数:5,代码来源:replace.ts

示例3: Promise

 return new Promise((resolve, reject) => {
   source.pipe(greplace('{{__version}}', version))
     .pipe(greplace('{{__apphost}}', apphost))
     .pipe(gulp.dest(`./.tmp/`))
     .on('end', () => {
       resolve()
     })
 })
开发者ID:jianxc,项目名称:teambition-mobile-web,代码行数:8,代码来源:replace.ts

示例4: require

gulp.task('build:client:script', () => {
	const client = require('./built/client/meta.json');
	return gulp.src(['./src/client/app/boot.js', './src/client/app/safe.js'])
		.pipe(replace('VERSION', JSON.stringify(client.version)))
		.pipe(replace('API', JSON.stringify(config.api_url)))
		.pipe(replace('ENV', JSON.stringify(env)))
		.pipe(replace('LANGS', JSON.stringify(Object.keys(locales))))
		.pipe(isProduction ? uglify({
			toplevel: true
		} as any) : gutil.noop())
		.pipe(gulp.dest('./built/client/assets/'));
});
开发者ID:ha-dai,项目名称:Misskey,代码行数:12,代码来源:gulpfile.ts

示例5: getPackageNamesConfig

task('generate-ts-config', () => {
  const { theme }: PackageNamesConfig = getPackageNamesConfig(process.argv);
  let stream = src('tsconfig.publish.json');

  for (const packageName of NEBULAR_PACKAGES) {
    stream = stream.pipe(replace(`@nebular/${dasherize(packageName)}`, theme))
  }

  return stream
    .pipe(rename('tsconfig-custom.publish.json'))
    .pipe(dest('.'));
});
开发者ID:kevinheader,项目名称:nebular,代码行数:12,代码来源:change-prefix.ts

示例6: getReplacements

task('change-prefix', ['copy-build-dir-and-rename', 'generate-ts-config', 'patch-rollup-config'], () => {
  const replacements: StringReplacement[] = getReplacements(getPackageNamesConfig(process.argv));

  let stream = src(`${BUILD_DIR}/**/*`);

  for (const { from, to } of replacements) {
    stream = stream.pipe(replace(from, to));
  }

  return stream
    .pipe(dest(BUILD_DIR))
    .on('end', replaceScssWithCss);
});
开发者ID:kevinheader,项目名称:nebular,代码行数:13,代码来源:change-prefix.ts

示例7: src

task('patch-rollup-config', () => {
  let stream = src(ROLLUP_CONFIG_PATH);
  const config: PackageNamesConfig = getPackageNamesConfig(process.argv);
  const { unscopedPrefix, unprefixed: unprefixedPackageNames } = config;
  const replacements: StringReplacement[] = getReplacements(config);

  // Add replacers for `nb.[package-name]`
  for (const [ nbPackageName, customPackageName ] of Object.entries(unprefixedPackageNames)) {
    replacements.push({
      from: `nb.${dasherize(nbPackageName)}`,
      to: `${unscopedPrefix}.${customPackageName}`,
    });
  }


  for (const { from, to } of replacements) {
    stream = stream.pipe(replace(from, to));
  }

  return stream.pipe(dest(ROLLUP_CONFIG_DIR));
});
开发者ID:kevinheader,项目名称:nebular,代码行数:21,代码来源:change-prefix.ts

示例8: function

gulp.task('templates', function(){
    gulp.src(['file.txt'])
        .pipe(replace("test", "foo"))
        .pipe(replace(/foo(.{3})/g, '$1foo'))
        .pipe(gulp.dest('build/file.txt'));
});
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:6,代码来源:gulp-replace-tests.ts


注:本文中的gulp-replace.default方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。