PostCSS Parcel Import Fix

0.0.2 · abandoned · verified Wed Apr 22

postcss-parcel-import is a PostCSS plugin, currently at version 0.0.2, designed as a temporary workaround for a specific `@import` bug (issue #1165) encountered in older versions of `parcel-bundler`. The plugin introduces a custom `@parcel-import` at-rule, which Parcel v1 users could leverage to ensure CSS `@import` rules were correctly processed before other PostCSS transformations. This package has seen no updates since 2018, coinciding with the closure of the Parcel issue it addressed and the deprecation of `parcel-bundler` (Parcel v1) in favor of Parcel v2. It differentiates itself by providing a very specific, now obsolete, syntax extension to handle a bug that has long since been resolved in the Parcel ecosystem. Its release cadence was minimal, comprising a single version.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to load and apply the `postcss-parcel-import` plugin using the PostCSS API.

const postcss = require('postcss');
const postcssParcelImport = require('postcss-parcel-import');

const cssInput = `
  @parcel-import '../mixins.pcss';
  .container {
    color: var(--primary-color);
  }
`;

async function processCss() {
  try {
    const result = await postcss([postcssParcelImport()]).process(cssInput, { from: 'src/app.css' });
    console.log('Processed CSS:\n', result.css);
    console.log('Warnings:\n', result.warnings().toString());
  } catch (error) {
    console.error('PostCSS processing error:', error);
  }
}

processCss();

/* 
Note: For this plugin to actually 'fix' an @import issue, 
      it needs to be run within the context of an affected 
      Parcel v1 build process. Running it standalone with 
      PostCSS will process the custom @parcel-import rule 
      but won't perform actual file inlining without further 
      custom PostCSS resolver logic or integration into Parcel.
      The example above merely demonstrates plugin invocation.
*/

view raw JSON →