How to use postcss-loader - 2 common examples

To help you get started, we’ve selected a few postcss-loader 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 silvenon / css-customs / packages / css-customs-loader / lib / index.js View on Github external
return callback(err)
  }

  const postcssLoader = this.loaders[postcssLoaderIndex]
  let postcssPlugins
  let postcssOptions

  // imitating postcss-loader behavior
  // https://github.com/postcss/postcss-loader/blob/master/src/index.js

  if (
    Object.keys(postcssLoader.options || {}).filter(
      option => !['ident', 'config', 'sourceMap'].includes(option)
    ).length > 0
  ) {
    const { options, plugins } = await parsePostcssLoaderOptions.call(
      this,
      postcssLoader.options
    )
    postcssOptions = options
    postcssPlugins = plugins
  } else {
    const file = this.resourcePath
    const rc = {
      path: path.dirname(file),
      ctx: {
        cwd: this.context,
        file: {
          extname: path.extname(file),
          dirname: path.dirname(file),
          basename: path.basename(file),
        },
github 4Catalyzer / astroturf / src / css-loader.js View on Github external
function postcss(loader, css, map, meta, cb) {
  const ctx = { ...loader };
  ctx.async = () => cb;
  ctx.loaderIndex++;
  ctx.query = {
    plugins: [postcssNested(), postcssAtroot()],
  };

  postcssLoader.call(ctx, css, map, meta);
}

postcss-loader

PostCSS loader for webpack

MIT
Latest version published 10 months ago

Package Health Score

88 / 100
Full package analysis