How to use gulp-rename - 10 common examples

To help you get started, we’ve selected a few gulp-rename examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zeit / now / test / dev / fixtures / 03-aurelia / aurelia_project / tasks / environment.js View on Github external
function configureEnvironment() {
  let env = CLIOptions.getEnvironment();

  return gulp.src(`aurelia_project/environments/${env}${project.transpiler.fileExtension}`)
    .pipe(rename(`environment${project.transpiler.fileExtension}`))
    .pipe(through.obj(function (file, _, cb) {
      // https://github.com/aurelia/cli/issues/1031
      fs.unlink(`${project.paths.root}/${file.relative}`, function () { cb(null, file); });
    }))
    .pipe(gulp.dest(project.paths.root))
    .pipe(through.obj(function(file, enc, cb) {
      // https://github.com/webpack/watchpack/issues/25#issuecomment-287789288
      const now = Date.now() / 1000;
      const then = now - 10;
      fs.utimes(file.path, then, then, function(err) { if (err) throw err; });
      cb(null, file);
    }));
}
github phodal / new-project-checklist / web / gulpfile.babel.js View on Github external
langs.forEach(lang => {
    return gulp.src(`./dist/index-en.html`)
      .pipe(htmlmin({
        collapseWhitespace: true,
        removeComments: true,
      }))
      .pipe(rename({
        basename: 'index',
      }))
      // .pipe(gulpif(lang !== 'en', gulp.dest(`${dirs.dest}/${lang}`), gulp.dest(`${dirs.dest}`)))
      .pipe(gulp.dest(`${dirs.dest}`));
  });
});
github github-tools / github / gulpfile.babel.js View on Github external
function buildBundle(options, extname, minify) {
   let stream = browserify(options)
      .transform('babelify')
      .bundle()
      .pipe(source('GitHub.js'))
      .pipe(buffer())
      .pipe(sourcemaps.init({
         loadMaps: true,
      }));

   if (minify) {
      stream = stream.pipe(uglify());
   }

   return stream.pipe(rename({extname}))
      .pipe(sourcemaps.write('.'))
      .pipe(gulp.dest('dist'))
      ;
}
github ka215 / jquery.timeline / gulpfile.babel.js View on Github external
export const styles = () => src('src/timeline.scss')
    .pipe(sourcemaps.init())
    .pipe(sass({outputStyle:'compressed'}))
    .pipe(autoprefixer())
    .pipe(rename('jquery.timeline.min.css'))
    .pipe(sourcemaps.write('.'))
    .pipe(dest('dist'))
github ben-eb / css-values / src / run.js View on Github external
return [
            ...conf,
            outputs[output],
        ];
    }, []);

    fileSystem.push(new File({
        path: resolve(`packages/css-values/index.js`),
        contents: new Buffer(generator.property(validatorConfig)),
    }), new File({
        path: resolve(`packages/css-values/test.js`),
        contents: new Buffer(generator.test(validatorConfig)),
    }));

    const stream = vfs.src(['./src/util/**/*.js', './src/validators/**/*.js'], {base: process.cwd()})
        .pipe(rename(renamer))
        .pipe(map((file, cb) => {
            fileSystem.push(file);
            cb(null, file);
        }));

    stream.on('close', () => {
        return writeBundle({
            entry: './packages/css-values/index.js',
            dest: './packages/css-values/index.js',
            files: fileSystem,
        }).then(writeBundle({
            entry: './packages/css-values/test.js',
            dest: './packages/css-values/test.js',
            files: fileSystem,
            external: [
                resolve('./packages/css-values/index.js'),
github dwst / dwst / gulpfile.babel.js View on Github external
export function buildImages() {
  return gulp.src(sourcePaths.images)
    .pipe(gulp.dest(targetDirs.images))
    .pipe(rename(p => {
      p.dirname = path.join(targetDirs.images, p.dirname);
    }))
    .pipe(browserSync.stream());
}
github guypeer8 / skeleton.js / gulpfile.babel.js View on Github external
gulp.task('default', () => {
	setVersion();
	return gulp.src('skeleton.js')
			.pipe(babel())
			.pipe(uglify())
			.pipe(rename({ suffix: '.min' }))
			.pipe(gulp.dest('.'));
});
github TheLarkInn / angular-starter-es6-webpack / gulpfile.babel.js View on Github external
.pipe(replace(/INCLUDE_ALL_MODULES\(\[(.*)\]/, function(match) {
      if (match.match(/\[\]/)) {
        return match.replace(']', `${name}Component]`);
      } else {
        return match.replace(']', `, ${name}Component]`);
      }
    }))
    .pipe(clean({force: true}))
    .pipe(gulp.dest(resolveToCommon()));

  let createNewCommonComponentBasedOnComponentTemplate = gulp.src(paths.blankTemplates)
    .pipe(template({
      name: name,
      upCaseName: cap(name)
    }))
    .pipe(rename((path) => {
      path.basename = path.basename.replace('temp', name);
    }))
    .pipe(gulp.dest(destPath));

    return merge(
      merge(addNewImportAndDependanciesToComponentsJS, createNewCommonComponentBasedOnComponentTemplate), 
      includeAdditionallSCSSFileInGlobalIndex
    );
});
github dwst / dwst / gulpfile.babel.js View on Github external
.pipe(postcss([
      atImport(),
      sprites({
        spritePath: targetDirs.images,
        stylesheetPath: targetDirs.styles,
        spritesmith: {
          padding: 2,
        },
      }),
      colorHexAlpha(),
      autoprefixer(),
      discardComments(),
    ]))
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest(targetDirs.styles))
    .pipe(rename(p => {
      p.dirname = path.join(targetDirs.styles, p.dirname);
    }))
    .pipe(browserSync.stream());
}
github cepave-f2e / vue-owl-ui / scripts / build.ui.js View on Github external
const exportsJS = (fs.readFileSync('src/components/index.js').toString())

const replaceExportsJS = exportsJS
  .replace('module.exports', `module.exports = ${JSON.stringify(requireComponents)}`)
  .replace(/"(require[^"]+)"/g, '$1')


fs.writeFileSync('src/components/index.js', replaceExportsJS)

exec('NODE_ENV=temp npm run pack.client')
exec('NODE_ENV=build npm run pack.client -- --display-modules')
rm(['npm/dist/*.css'])

gu.src('npm/dist/*.js', { base: 'npm' })
  .pipe(uglify())
  .pipe(rename({
    suffix: '.min',
  }))
  .pipe(gu.dest('npm'))
  .on('finish', ()=> {
    const pkg = require('../package.json')
    const { scripts, devDependencies, jest, ...packageJSON } = pkg

    fs.writeFile('npm/package.json', JSON.stringify(packageJSON, null, 2))

    gu.src('README.md')
      .pipe(gu.dest('npm'))
      .on('finish', ()=> {
        log(`outputs to: ${c.cyan('npm/')}`)

        gu.src('npm/**')
          .pipe(size({

gulp-rename

Rename files

MIT
Latest version published 4 years ago

Package Health Score

71 / 100
Full package analysis

Popular gulp-rename functions