4.1.1 • Published 5 years ago

spike-css-standards v4.1.1

Weekly downloads
87
License
MIT
Repository
github
Last release
5 years ago

Spike CSS Standards

npm tests dependencies coverage

A standard plugin pack for postcss

Installation

npm install spike-css-standards -S

Usage

This is nothing more than a light wrapper around a postcss configuration object. Options are filtered into their appropriate plugins internally. All are optional.

const postcss = require('postcss')
const cssStandards = require('spike-css-standards')

const standards = cssStandards(/* options */)
// returns { parser: 'xxx', plugins: ['xxx'] }

postcss(standards.plugins)
  .process(/* css string */, { parser: standards.parser })
  .then((res) => { console.log(res.content) })

By default, the css standard plugin pack includes:

Any of these plugins can be customized by passing the options described below. You can also add additional postCSS plugins (like the popular lost grid, for example) on top of this package:

const cssStandards = require('spike-css-standards')
const lost = require('lost')

const css = cssStandards()
css.plugins.push(lost())

Options

NameDescriptionDefault
rootRoot used to resolve path(s) from
pathA path to a folder or an array of paths, telling postcss-import where to look for sss or css files to @import.
rucksackOptions passed directly to rucksack
postcssImportOptions passed to postcss-import
autoprefixerOptions passed to autoprefixer
attributeCaseInsensitiveOptions passed to postcss-attribute-case-insensitive
calcOptions passed to postcss-calc
colorFunctionOptions passed to postcss-color-function
colorGrayOptions passed to postcss-color-gray
colorHexAlphaOptions passed to postcss-color-hex-alpha
colorHslOptions passed to postcss-color-hsl
colorHwbOptions passed to postcss-color-hwb
colorRebeccapurpleOptions passed to postcss-color-rebeccapurple
colorRgbOptions passed to postcss-color-rgb
customMediaOptions passed to postcss-custom-media
customPropertiesOptions passed to postcss-custom-properties
customSelectorsOptions passed to postcss-custom-selectors
fontFamilySystemUiOptions passed to postcss-font-family-system-ui
fontVariantOptions passed to postcss-font-variant
propertyLookupOptions passed to postcss-property-lookup
imageSetOptions passed to postcss-image-set-polyfill
mediaQueriesRangeOptions passed to postcss-media-minmax
nestingOptions passed to postcss-nesting
pseudoClassAnyLinkOptions passed to postcss-pseudo-class-any-link
pseudoClassMatchesOptions passed to postcss-selector-matches
pseudoClassNotOptions passed to postcss-selector-not
cssnanoOptions passed to cssnano
parsercustom css parser if desired. pass false to use the default css parsersugarss
minifyMinifies the css output by removing excess spaces and line breaksfalse
appendPluginsAdds a single plugin or array of plugins after all the defaults
prependPluginsAdds a single plugin or array of plugins before all the defaults

License & Contributing