How to use postcss-discard-comments - 5 common examples

To help you get started, we’ve selected a few postcss-discard-comments 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 SparkPost / heml / packages / heml-styles / src / index.js View on Github external
async function hemlstyles (contents, options = {}) {
  const {
    elements = {},
    aliases = {},
    plugins = []
  } = options

  return postcss([
    ...plugins,

    // /** optimize css */
    discardComments({ removeAll: false }),
    minifyGradients(),
    normalizeDisplayValues(),
    normalizeTimingFunctions(),
    convertValues({ length: false }),
    reduceCalc(),
    orderedValues(),
    minifySelectors(),
    minifyParams(),
    discardOverridden(),
    normalizeString(),
    minifyFontValues({ removeQuotes: false }),
    normalizeRepeatStyle(),
    normalizePositions(),
    discardEmpty(),
    uniqueSelectors(),
    declarationSorter(),
github Zimbra / zimlet-cli / src / index.js View on Github external
let cssLoaderOptions = {
		sourceMap: watch && !PROD
	};

	let postCssLoaderOptions = {
		sourceMap: true,
		plugins: [
			cssnext({
				browsers: ['last 2 versions', 'not ie > 0', 'iOS >= 8'] ,
				features: {
					//disable customProperties plugin so css variables and :root blocks are preserved
					customProperties: false
				}
			}),
			discardComments({ removeAll: true })
		]
	};

	let cssModulesRegexp = crossPlatformPathRegex(/(?:([^/@]+?)(?:-(?:pages?|components?|screens?))?\/)?src\/(?:pages|components|screens)\/(.+?)(\/[a-z0-9._-]+[.](less|css))?$/);

	let webpackConfig = {
		mode: PROD ? 'production' : 'development',
		context,
		entry: path.resolve(__dirname, 'entry.js'),

		output: {
			path: dest,
			filename: `index.js`,
			chunkFilename: '[name].[chunkhash:8].chunk.js',
			// NOTE: Explicit public path is required in order to make HMR work within an sourceless iframe.
			// This is due to a bug in webpack-dev-server that uses the document protocol for all https pages:
github sebastian-software / edgestack / src / webpack / PostCSSConfig.js View on Github external
export default function PostCSSConfig(variables = {})
{
  return [
    atImport(),
    simpleUrl(),
    assets(),

    // Discard comments in your CSS files with PostCSS.
    // https://github.com/ben-eb/postcss-discard-comments
    // Remove all comments... we don't need them further down the line
    // which improves performance (reduces number of AST nodes)
    discardComments({
      removeAll: true
    }),

    // Automagical responsive typography. Adds a responsive property to font-size,
    // line-height and letter-spacing that generates complex calc and vw based font sizes.
    // https://github.com/seaneking/postcss-responsive-type
    responsiveType(),

    // Sass-like mixins
    // Needs to be executed before any variable handling plugins
    // https://github.com/andyjansson/postcss-sassy-mixins
    sassyMixins,

    // PostCSS plugin for Sass-like variables, conditionals, and iteratives
    // Supports local variables + @for/@each inspired by Sass
    // https://github.com/jonathantneal/postcss-advanced-variables
github dwst / dwst / gulpfile.babel.js View on Github external
export function buildCss() {
  return gulp.src(sourcePaths.cssEntry)
    .pipe(sourcemaps.init())
    .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 dwst / dwst / gulpfile.babel.js View on Github external
export function buildCss() {
  return gulp.src(sourcePaths.cssEntry)
    .pipe(sourcemaps.init())
    .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());
}

postcss-discard-comments

Discard comments in your CSS files with PostCSS.

MIT
Latest version published 3 months ago

Package Health Score

97 / 100
Full package analysis

Popular postcss-discard-comments functions