How to use gulp-postcss - 10 common examples

To help you get started, we’ve selected a few gulp-postcss 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 colinrotherham / core / src / tasks / css.js View on Github external
return () => gulp.src(config.src, { dot: true })

  // Start sourcemaps
    .pipe(sourcemaps.init())

  // Process Sass
    .pipe(sass(options.sass).on('error', sass.logError))

  // Process PostCSS
    .pipe(postcss([
      autoprefixer(options.autoprefixer),
      csswring(options.csswring),
      mqpacker(options.mqpacker),
    ]))

  // Rename
    .pipe(rename({
      extname: '.min.css',
    }))

  // Write to files
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest(config.dest))

  // Reload in browser
    .pipe(browserSync.stream({ match: '**/*.css' }));
github googleanalytics / ga-dev-tools / gulpfile.babel.js View on Github external
postcssUrl(),
    postcssCssnext({
      browsers: '> 1%, last 2 versions, Safari > 5, ie > 9, Firefox ESR',
    }),
    postcssReporter(),
  ];
  // Compress in production.
  if (isProd()) {
    processors.push(cssnano({autoprefixer: false}));
  }

  return gulp.src([
    './src/css/index.css',
    './src/css/chartjs-visualizations.css',
  ]).pipe(plumber({errorHandler: streamError}))
      .pipe(postcss(processors))
      .pipe(gulp.dest('public/css'));
};
github bordoni / fakerpress / gulpfile.babel.js View on Github external
export function styles() {
	const plugins = [
		autoprefixer,
		postcssImport,
		postcssMixins,
		postcssNested,
		postcssInlineSvg,
		postcssCalc,
		postcssHexrgba,
		cssMqpacker,
	];

	return gulp.src( paths.styles.src )
		.pipe( postcss( plugins ) )
		.pipe( cleanCSS() )
		// pass in options to the stream
		.pipe( rename( {
			suffix: '.min',
			extname: '.css'
		} ) )
		.pipe( gulp.dest( paths.styles.dest ) );
}
github HandshakeAlliance / testnet-faucet / gulpfile.babel.js View on Github external
function css() {
  var plugins = [
    postcssImport(),
    precss(),
    autoprefixer({
      path: ["src/public/css"]
    }),
    cssnano()
  ];

  return gulp
    .src(paths.styles.src)
    .pipe(sourcemaps.init())
    .pipe(postcss(plugins))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest(paths.styles.dest));
}
github sheabunge / code-snippets / gulpfile.babel.js View on Github external
() => gulp.src(src_files.css)
			.pipe(rename({extname: '.css'}))
			.pipe(sourcemaps.init())
			.pipe(postcss(processors))
			.pipe(sourcemaps.write('.'))
			.pipe(gulp.dest(dist_dirs.css)),
		() => gulp.src(dir_css.map((f) => dist_dirs.css + f))
github nstungcom / gulp-starter-kit / gulpfile.babel.js View on Github external
function css () {
  return gulp.src('src/assets/scss/app.scss')
    .pipe(sourcemaps.init())
    .pipe(sass({ includePaths: PATHS.sassLibs }).on('error', sass.logError))
    .pipe(gulpif(PRODUCTION, postcss([autoprefixer(), cssnano()])))
    .pipe(gulpif(!PRODUCTION, sourcemaps.write('.')))
    .pipe(gulp.dest(`${PATHS.dist}/assets/css`))
}
github escueladigital / EDboilerplate / gulpfile.babel.js View on Github external
gulp.task('styles-dev', () => {
  gulp.src('./src/scss/styles.scss')
    .pipe(sourcemaps.init({ loadMaps : true}))
    .pipe(plumber())
    .pipe(sass({
      importer: tildeImporter,
      outputStyle: 'expanded',
      includePaths: ['./node_modules']
    }))
    .pipe(postcss(postcssPlugins))
    .pipe(sourcemaps.write('.'))
    .pipe(gulp.dest('./public/assets/css/'))
    .pipe(server.stream({match: '**/*.css'}))
})
github elementary / houston / gulpfile.babel.js View on Github external
const functionPostCSS = (file) => {
  const buildFiles = (file == null) ? ['src/**/*.css'] : file

  return gulp.src(buildFiles, { base: 'src' })
  .pipe(postcss([
    cssnext({ browsers })
  ]))
  .pipe(gulp.dest('build'))
}
github wulkano / getkap.co / gulpfile.babel.js View on Github external
export function styles() {
  return src(CSS_GLOB)
    .pipe(postcss(processors))
    .pipe(postcss([minify]))
    .pipe(rev())
    .pipe(dest(BUILD_DIR))
    .pipe(rev.manifest())
    .pipe(dest(BUILD_DIR));
}
github andrew--r / frontendbookshelf / gulp / tasks / styles.js View on Github external
gulp.task('styles', () => {
	return gulp
		.src(`${PATHS.source.styles.common}/index.css`)
		.pipe(plumber(getPluginOptions('plumber')))
		.pipe(postcss([
			easyImport(getPluginOptions('postcssEasyImport')),
			cssnext(),
			csso(),
			flexbugsFixes(),
			reporter({ clearAllMessages: true }),
		]))
		.pipe(rename('main.css'))
		.pipe(gulp.dest(PATHS.build.styles));
});

gulp-postcss

PostCSS gulp plugin

MIT
Latest version published 11 months ago

Package Health Score

66 / 100
Full package analysis

Popular gulp-postcss functions