本文整理汇总了TypeScript中merge2类的典型用法代码示例。如果您正苦于以下问题:TypeScript merge2类的具体用法?TypeScript merge2怎么用?TypeScript merge2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了merge2类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: merge2
gulp.task('app-js', () =>
merge2(
gulp.src('static/src/tpl/*.html'),
gulp.src([
'static/src/js/app.js',
'static/src/js/locale_zh-cn.js',
'static/src/js/router.js',
'static/src/js/tools.js',
'static/src/js/services.js',
'static/src/js/filters.js',
'static/src/js/directives.js',
'static/src/js/controllers.js'
])
)
.pipe(gulp.dest('static/dist/js/'))
示例2: default
export default (target: string) => {
const paths = {
less: [
'./src/less/*.less',
'./src/components/**/*.less',
`./src/${target}/**/*.less`
],
tbui: [
'./src/less/tb-fonts-variables.less',
'./tools/libs/less/teambition-ui-variables.less',
'./tools/libs/less/teambition-ui-icons.less'
]
}
const stream = merge2(
gulp.src(paths.tbui)
.pipe(concat('tbui.less'))
.pipe(logError(less())),
gulp.src(paths.less)
.pipe(sourcemaps.init({
loadMaps: true
}))
.pipe(logError(less()))
.pipe(sourcemaps.write())
)
.pipe(sourcemaps.init({
loadMaps: true
}))
.pipe(concat('app.css'))
.pipe(autoprefixer({
browsers: ['last 2 versions']
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest(`www/css/`))
return new Promise((resolve, reject) => {
stream.on('end', () => {
gutil.log(gutil.colors.yellow('complete less'))
resolve()
})
})
}
示例3: 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()
})
})
}
示例4: merge2
'static/src/js/directives.js',
'static/src/js/controllers.js'
])
)
.pipe(gulp.dest('static/dist/js/'))
);
const stream1 = gulp.src('*.html');
const stream2 = gulp.src('*.html');
const stream3 = gulp.src('*.html');
const stream4 = gulp.src('*.html');
const stream5 = gulp.src('*.html');
const stream6 = gulp.src('*.html');
const stream7 = gulp.src('*.html');
let stream = merge2([stream1, stream2], stream3, {end: false});
stream.once('queueDrain', () => {
stream.add(stream4, stream5);
});
// ..
stream.end();
// equal to merge2([stream1, stream2], stream3)
stream = merge2();
stream.add([stream1, stream2]);
stream.add(stream3);
stream.on('data', (data: any) => {
console.log(data);
示例5: merge
task('demos.bundle', function () {
var tsResult = tsCompile(getTscOptions('es6'), 'system')
.pipe(babel(babelOptions));
var swiper = src('src/components/slides/swiper-widget.system.js');
return merge([tsResult, swiper])
.pipe(remember('system'))
.pipe(concat('ionic.system.js'))
.pipe(dest(`${DIST_NAME}/bundles`))
.pipe(connect.reload());
});
示例6: merge
task('typescript', () => {
let project = createProject('tsconfig.json');
const {js, dts} = project.src()
.pipe(newer(`${PATH_COMMON.SRC}/**/*`))
.pipe(sourcemaps.init())
.pipe(project());
return merge([
js.pipe(dest(PATH_COMMON.DIST)),
dts.pipe(dest(PATH_COMMON.DIST)),
]);
});
示例7: merge
/**
* Typescript compile task
*/
@Task('ts::compile')
tscompile(): any {
let sourcepaths = ['typings/main.d.ts'];
sourcepaths.push(this.config.paths.source);
var tsResult = gulp.src(sourcepaths)
.pipe(plumber())
.pipe(ts(this.tsProject));
return merge([
tsResult.dts.pipe(gulp.dest('definitions')),
tsResult.js.pipe(gulp.dest(this.config.paths.dist))
]);
}
示例8: merge
task('e2e.build', function () {
var indexTemplate = template(
readFileSync(`${SCRIPTS_ROOT}/${E2E_NAME}/e2e.template.dev.html`).toString()
)({
buildConfig: buildConfig
});
// Get each test folder with src
var tsResult = src([
'src/components/*/test/*/**/*.ts',
'!src/components/*/test/*/**/*.spec.ts'
])
.pipe(cache('e2e.ts'))
.pipe(tsc(getTscOptions(), undefined, tscReporter))
.on('error', function (error) {
console.log(error.message);
})
.pipe(gulpif(/app-module.js$/, createIndexHTML()))
.pipe(gulpif(/e2e.js$/, createPlatformTests()));
var testFiles = src([
'src/components/*/test/*/**/*',
'!src/components/*/test/*/**/*.ts'
])
.pipe(cache('e2e.files'));
return merge([
tsResult,
testFiles
])
.pipe(rename(function (file) {
file.dirname = file.dirname.replace(sep + 'test' + sep, sep);
}))
.pipe(dest(DIST_E2E_ROOT))
.pipe(connect.reload());
function createIndexHTML() {
return obj(function (file, enc, next) {
this.push(new VinylFile({
base: file.base,
contents: new Buffer(indexTemplate),
path: join(dirname(file.path), 'index.html'),
}));
next(null, file);
});
}
function createPlatformTests() {
let platforms = [
'android',
'ios',
'windows'
];
let testTemplate = template(readFileSync(`${SCRIPTS_ROOT}/${E2E_NAME}/e2e.template.js`).toString());
return obj(function (file, enc, next) {
let self = this;
let relativePath = dirname(file.path.replace(/^.*?src(\/|\\)components(\/|\\)/, ''));
relativePath = relativePath.replace('/test/', '/');
let contents = file.contents.toString();
platforms.forEach(function (platform) {
let platformContents = testTemplate({
contents: contents,
buildConfig: buildConfig,
relativePath: relativePath,
platform: platform
});
self.push(new VinylFile({
base: file.base,
contents: new Buffer(platformContents),
path: file.path.replace(/e2e.js$/, platform + '.e2e.js')
}));
});
next();
});
}
});