How to use gulp-changed - 10 common examples

To help you get started, we’ve selected a few gulp-changed 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 CMSgov / design-system / tools / gulp / sass / index.js View on Github external
assetPaths: [
            path.resolve(__dirname, '../../../', cwd, 'images'),
            path.resolve(__dirname, '../../../', 'packages/core/images')
          ],
          strict: true
        })
      );
    }

    return gulp
      .src(`${cwd}src/**/*.scss`)
      .pipe(
        changed(dest, {
          extension: '.css',
          // compare contents so files that import the updated file also get piped through
          hasChanged: changed.compareSha1Digest
        })
      )
      .pipe(gulpIf(createSourcemaps, sourcemaps.init()))
      .pipe(sassCompiler)
      .pipe(gulpIf(createSourcemaps, sourcemaps.write()))
      .pipe(postcss(postcssPlugins))
      .pipe(gulp.dest(dest))
      .pipe(count(`## Sass files processed in ${cwd}`))
      .pipe(shared.browserSync.stream({ match: '**/public/styles/*.css' })); // Auto-inject into docs
  }
github alienfast / gulp-pipeline / src / images.js View on Github external
runOne(done, cwd, watching) {

    // setup a run with a single cwd a.k.a base directory FIXME: perhaps this could be in the base recipe? or not?
    let options = extend(true, {}, this.config.source.options)
    options.cwd = cwd
    this.debug(`src: ${cwd}/${this.config.source.glob}`)

    return this.gulp.src(this.config.source.glob, options)
      .pipe(changed(this.config.dest)) // ignore unchanged files
      .pipe(gulpif(this.config.debug, debug(this.debugOptions())))
      .pipe(imagemin(this.config.options))
      .on('error', (error) => {
        this.notifyError(error, done, watching)
      })
      .pipe(this.gulp.dest(this.config.dest))
      .pipe(this.browserSync.stream())
  }
}
github ournameismud / mud-fractal / gulp / tasks / assets.js View on Github external
export function favicons() {
	const paths = getPaths('favicons')

	return gulp
		.src(paths.src)
		.pipe(changed(paths.dest)) // Ignore unchanged files
		.pipe(gulp.dest(paths.dest))
		.pipe(browserSync.stream())
}
github genesishq / genesis / gulp / tasks / fonts.js View on Github external
gulp.task('fonts', () => {
  return gulp.src(config.src)
    .pipe(changed(config.dest)) // Ignore unchanged files
    .pipe(gulp.dest(config.dest))
    .pipe(browserSync.reload({stream: true}));
});
github mangalam-research / wed / gulptasks / gulpfile.js View on Github external
gulp.task("config", () => {
  const dest = "build/config";
  // In effect, anything in localConfigPath overrides the same file in
  // config.
  const configPath = "config";
  const localConfigPath = "local_config";
  return gulp.src(path.join(configPath, "**"), { nodir: true })
    .pipe(es.map((file, callback) =>
                 vinylFile.read(
                   path.join(localConfigPath, file.relative),
                   { base: localConfigPath })
                 .then(override => callback(null, override),
                       () => callback(null, file))))
  // We do not use newer here as it would sometimes have
  // unexpected effects.
    .pipe(changed(dest, { hasChanged: changed.compareContents }))
    .pipe(gulp.dest(dest));
});
github colinrotherham / core / tasks / copy.js View on Github external
const pathsCopy = [

		// Copy all files
		`${config.paths.src}/**/*.*`,

		// Skip templates
		`!${config.paths.src}/templates`,
		`!${config.paths.src}/templates/**`,

		// Skip assets
		`!${config.paths.src}/assets`,
		`!${config.paths.src}/assets/**`
	];

	const options = {
		hasChanged: changed.compareContents
	};

	return () => stream.merge(

		gulp.src(pathsCopy, { dot: true })
			.pipe(changed(config.paths.build, options))
			.pipe(gulp.dest(config.paths.build))
			.pipe(preservetime()),

		gulp.src(`${config.paths.srcAssets}/**`, { dot: true })
			.pipe(changed(config.paths.build, options))
			.pipe(gulp.dest(config.paths.buildAssets))
			.pipe(preservetime())
	);
};
github agconti / cookiecutter-es6-boilerplate / {{ cookiecutter.github_repository_name }} / gulp / build.javascript.js View on Github external
export function buildJs () {
  return gulp.src(jsSrc)
    .pipe(changed(distDir))
    .pipe(sourcemaps.init())
    .pipe(babel({modules}).on('error', logError))
    .pipe(concat('all.min.js'))
    .pipe(uglify().on('error', logError))
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest(distDir))
}
github victorporof / Sublime-HTMLPrettify / tasks / task-build.js View on Github external
gulp.task('build:babel', () => gulp.src(`${SRC_DIR}/**/*.js`)
  .pipe(changed(BUILD_DIR, { extension: '.js' }))
  .pipe(debug({ title: 'Running babel' }))
  .pipe(sourcemaps.init())
  .pipe(babel(BABELRC_CONTENTS))
  .pipe(sourcemaps.write())
  .pipe(gulp.dest(BUILD_DIR)));
github atdrago / negative / gulpfile.js View on Github external
function compileJs(src, dest, filename) {
	return gulp.src(src)
		.pipe(concat(filename))
		.pipe(wrap("(function (window, document, JSON) { <%= contents %> })(window, document, JSON);"))
		.pipe(gulpUglify({}, uglifyJs).on('error', (err) => console.log(err)))
		.pipe(changed(jsDest, {
			hasChanged: changed.compareSha1Digest
		}))
		.pipe(gulp.dest(dest));
}

gulp-changed

Only pass through changed files

MIT
Latest version published 12 months ago

Package Health Score

66 / 100
Full package analysis