Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parcel 2: PostCSS transform #2157

Closed
devongovett opened this issue Oct 17, 2018 · 3 comments
Closed

Parcel 2: PostCSS transform #2157

devongovett opened this issue Oct 17, 2018 · 3 comments

Comments

 @devongovett
Copy link
Member

Create the @parcel/transform-postcss package in packages/transforms/postcss . This package is a Parcel 2 transform plugin for PostCSS. It will be based on the postcss transform inside CSSAsset from Parcel 1, separated into its own package.

The @parcel/transform-postcss package is responsible for the following things:

  • Loading .postcssrc configs
  • Parsing an AST if needed
  • Transforming with PostCSS
  • Generating a string if needed
 @devongovett devongovett added this to the Parcel 2 milestone Oct 17, 2018
 @devongovett devongovett added this to To do in Parcel 2 via automation Oct 17, 2018
 @padmaia padmaia self-assigned this Dec 18, 2018
 @padmaia padmaia moved this from To do to In progress in Parcel 2 Jan 3, 2019
 @jhpratt
Copy link

@padmaia Will this allow compilation of entire bundles, rather than each file individually? It's my understanding that's why things like @import don't currently work when using PostCSS.

 @padmaia
Copy link
Contributor

@jhpratt tbh, I've shelved this task while I've been working on some more pressing issues in core. After reading through #1165 we may still want to have the default PostCSS transformer work on a file per file basis so that the performance is optimal by default (parallelization and more granular caching), but it should definitely be possible to configure a custom PostCSS transform that supports your needs. It also might be possible to get the best of both worlds. Perhaps an optimizer plugin that runs over an entire package could replace all of the variables. I'm not sure if that would work or be desirable though 🤷‍ ♀️

 @padmaia padmaia moved this from In progress to To do in Parcel 2 Apr 4, 2019
 @wbinnssmith wbinnssmith self-assigned this Apr 16, 2019
 @mischnic
Copy link
Member

Reading #2983 , there is a message() function where plugins register dependencies.
This way, a PostCSS plugin that resolves the imports (e.g. ( postcss-import ]( https://github.com/postcss/postcss-import/blob/master/index.js#L199 )) can forward the dependency list to Parcel for the watcher/HMR.

 @devongovett devongovett moved this from To do to In progress in Parcel 2 May 18, 2019
Parcel 2 automation moved this from In progress to Done Jul 10, 2019
ai pushed a commit to postcss/postcss that referenced this issue Jul 17, 2019
 * Fix README.md claim of "perfect" Parcel support Update `README.md` to not tout Parcel's implementation as "perfect". There are [the several issues in Version 1]( https://github.com/parcel-bundler/parcel/labels/CSS%20Preprocessing ).  And [Version 2]( https://github.com/parcel-bundler/parcel/projects/5 ) is not out yet to [possibly fix the issues via [issue #2157]( parcel-bundler/parcel#2157 ). I am amenable to any alteration of this edit. Perhaps, the change should be _only_ to remove the word "perfect". But,  Parcel's implementation has been flawed for a long time. _I provide the extra information,  in hopes of saving someone else from believing Parcel will manage PostCSS for them. Three times over this and the past years, I have crawled out of the maze of Parcel & PostCSS rabbit holes to decide that it is _still_ better for a project to process with PostCSS directly, independently of Parcel._ * Fix README.md grammar in previous edit I fixed grammatical errors that I made in my previous edit of the README.md.
Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment
Projects
No open projects
Parcel 2
   
Done
Development

No branches or pull requests

5 participants