本文整理汇总了TypeScript中gulp-rename类的典型用法代码示例。如果您正苦于以下问题:TypeScript gulp-rename类的具体用法?TypeScript gulp-rename怎么用?TypeScript gulp-rename使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了gulp-rename类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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...`);
});
});
示例2: newer
gulp.task("scripts:coffee", () => {
return gulp.src('./src/coffee/**/*.coffee')
.pipe(gulpif(argv.incremental, newer({dest: paths.buildDir.jsTree, ext: '.js'})))
.pipe(coffee({bare: true}))
.pipe(rename((path) => path.extname = '.ts'))
.pipe(gulp.dest(paths.buildDir.jsTree + '_ts'))
})
示例3: configureEnvironment
function configureEnvironment() {
let env = CLIOptions.getEnvironment();
return gulp.src(`aurelia_project/environments/${env}.js`)
.pipe(rename('environment.js'))
.pipe(gulp.dest(project.paths.root));
}
示例4: 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));
});
示例5: getBrowserCodeStream
export function getBrowserCodeStream(opts?: PrebootOptions): any {
opts = normalize(opts);
let bOpts = {
entries: [__dirname + '/../browser/preboot_browser.js'],
standalone: 'preboot',
basedir: __dirname + '/../browser',
browserField: false
};
let b = browserify(bOpts);
// ignore any strategies that are not being used
ignoreUnusedStrategies(b, bOpts, opts.listen, listenStrategies, './listen/listen_by_');
ignoreUnusedStrategies(b, bOpts, opts.replay, replayStrategies, './replay/replay_after_');
if (opts.freeze) {
ignoreUnusedStrategies(b, bOpts, [opts.freeze], freezeStrategies, './freeze/freeze_with_');
}
// ignore other code not being used
if (!opts.buffer) { b.ignore('./buffer_manager.js', bOpts); }
if (!opts.debug) { b.ignore('./log.js', bOpts); }
// use gulp to get the stream with the custom preboot browser code
let outputStream = b.bundle()
.pipe(source('src/browser/preboot_browser.js'))
.pipe(buffer())
.pipe(insert.append('\n\n;preboot.init(' + stringifyWithFunctions(opts) + ');\n\n'))
.pipe(rename('preboot.js'));
// uglify if the option is passed in
return opts.uglify ? outputStream.pipe(uglify()) : outputStream;
}
示例6: require
gulp.task("scripts:coffee", () => {
return gulp.src('./src/coffee/**/*.coffee')
.pipe(coffee({coffee: require("coffeescript"), bare: true}))
.on("error", function(error: any) { console.error(error.toString()); process.exit(1) })
.pipe(change(function(code: string) {
const lines = code.split("\n")
const names = new Set<string>()
const r1 = /^export var (\w+) = \(function\(\) {$/
const r2 = /^ return (\w+);$/
for (let i = 0; i < lines.length; i++) {
const line = lines[i]
let match = line.match(r1)
if (match != null) {
names.add(match[1])
lines[i] = ""
i++
lines[i] = `export ${lines[i].trim()}`
continue
}
match = line.match(r2)
if (match != null && names.has(match[1])) {
lines[i] = ""
i++
lines[i] = ""
i++
lines[i] = ""
}
}
return lines.join("\n")
}))
.pipe(rename((path) => path.extname = '.ts'))
.pipe(gulp.dest(paths.build_dir.tree_ts))
})
示例7:
const tasks = [paths.coffee.bokehjs, paths.coffee.api, paths.coffee.widgets, paths.coffee.gl].map((entry) => {
return gulp.src(entry.destination.fullWithPath)
.pipe(rename((path) => path.basename += '.min'))
.pipe(uglify({ output: {comments: /^!|copyright|license|\(c\)/i} }))
.pipe(insert.append(license))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.buildDir.js))
})
示例8: configureEnvironment
function configureEnvironment() {
let env = CLIOptions.getEnvironment();
return gulp.src(`aurelia_project/environments/${env}.ts`)
.pipe(changedInPlace({firstPass:true}))
.pipe(rename('environment.js'))
.pipe(gulp.dest(project.paths.root));
}
示例9:
gulp.task("scripts:minify", ["scripts:bundle"], () => {
return gulp.src(`${paths.build_dir.js}/!(*.min|compiler).js`)
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(rename((path) => path.basename += '.min'))
.pipe(minify({ output: { comments: /^!|copyright|license|\(c\)/i } }))
.pipe(insert.append(license))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(paths.build_dir.js))
})
示例10:
gulp.task("styles:minify", () => {
return gulp.src(paths.css.sources)
.pipe(rename((path) => path.basename += ".min"))
.pipe(sourcemaps.init({
loadMaps: true,
}))
.pipe(uglifycss())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.build_dir.css))
})