question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add an option to pass plugins to patchPostCSS in webpack.config.js

See original GitHub issue

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[X] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

It would be cool to pass an array of postcss plugins to patchPostCSS and append them after tailwind. (As an optional argument)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
vltanskycommented, Jan 29, 2021

@TryHardDood I’m working on this kind of plugin. It’s still in development stage, but you can give it a try: https://github.com/vltansky/patchAngularPostCSS

npm i patch-angular-postcss -D in webpack.config.js:

const { patchAngularPostCSS } = require("patch-angular-postcss");


module.exports = (config) => {
  patchAngularPostCSS({
    webpackConfig: config,
    addPlugins: [
      require("postcss-preset-env"),
      require("postcss-css-variables")
    ],
  });
  return config;
};

together with tailwind it will look like:

const { patchPostCSS } = require("@ngneat/tailwind");
const tailwindConfig = require("./tailwind.config.js");

module.exports = (config) => {
  patchPostCSS(config, tailwindConfig);
  patchAngularPostCSS({
    webpackConfig: config,
    addPlugins: [
      require("postcss-preset-env"),
      require("postcss-css-variables")
    ],
  });
  return config;
};

Just to mention I do not recommend trying to add tailwind using patchAngularPostCSS, as ngneat/tailwind have extra optimizations under the hood, so tailwind will work seamlessly with Angular.

@nartc I do think that even if we decide to not simplify postcss function, we should rename it to addTailwindCSS, as the name now is giving the wrong expectation from it.

1reaction
TryHardDoodcommented, Jan 30, 2021

Sure. I support the idea of renaming the function to addTailwindCSS

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plugins - webpack
A webpack plugin is a JavaScript object that has an apply method. ... you must pass a new instance to the plugins property...
Read more >
Plugins - webpack
Plugins. The plugins option is used to customize the webpack build process in a variety of ways. Webpack comes with a variety built-in...
Read more >
postcss-loader | webpack - JS.ORG
Then add the plugin to your webpack config. For example: ... If you use JS styles the postcss-js parser, add the execute option....
Read more >
Writing a Plugin - webpack
Be prepared to read some source code! Creating a Plugin. A plugin for webpack consists of: A named JavaScript function or a JavaScript...
Read more >
Configuration - webpack
config.js file in the root folder and webpack will automatically use it. All the available configuration options are specified below. tip.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found