How to use postcss-calc - 3 common examples

To help you get started, we’ve selected a few postcss-calc 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
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(),
    mergeAdjacentMedia(),
    discardDuplicates(),
    mergeRules(),

    /** color handling */
github wprig / wprig / gulp / editorStyles.js View on Github external
features: (
				configValueDefined('config.dev.styles.features') ?
				config.dev.styles.features :
				{
					'custom-media-queries': {
						preserve: false
					},
					'custom-properties': {
						// Preserve must always be false for the editor
						preserve: false
					},
					'nesting-rules': true
				}
			)
		}),
		calc({
			preserve: false
		}),
		cssnano(),
	];

	// Skip minifying files if we aren't building for
	// production and debug is enabled
	if( config.dev.debug.styles && ! isProd ) {
		postcssPlugins.pop();
	}

	// Report messages from other postcss plugins
	postcssPlugins.push(
		reporter({ clearReportedMessages: true })
	);
github wprig / wprig / gulp / styles.js View on Github external
),
			features: (
				configValueDefined('config.dev.styles.features') ?
				config.dev.styles.features :
				{
					'custom-media-queries': {
						preserve: false
					},
					'custom-properties': {
						preserve: true
					},
					'nesting-rules': true
				}
			)
		}),
		calc({
			preserve: false
		}),
		cssnano(),
	];

	// Skip minifying files if we aren't building for
	// production and debug is enabled
	if( config.dev.debug.styles && ! isProd ) {
		postcssPlugins.pop();
	}

	// Report messages from other postcss plugins
	postcssPlugins.push(
		reporter({ clearReportedMessages: true })
	);

postcss-calc

PostCSS plugin to reduce calc()

MIT
Latest version published 4 months ago

Package Health Score

90 / 100
Full package analysis

Popular postcss-calc functions