Anidetrix / rollup-plugin-styles

🎨 Universal Rollup plugin for styles: PostCSS, Sass, Less, Stylus and more.
https://anidetrix.github.io/rollup-plugin-styles
MIT License
242 stars 43 forks source link

Feature Request: Support `postcss.config.ts` #189

Open alvis opened 2 years ago

alvis commented 2 years ago

Currently, rollup-plugin-styles uses cosmiconfig for loading postcss config file. However, it doesn't support '.ts' file out of the box. For postcss.config.ts, the official recommendation is to supply a third party custom loader like @endemolshinegroup/cosmiconfig-typescript-loader.

What we need to do is to add a line in https://github.com/Anidetrix/rollup-plugin-styles/blob/b40268744b57faf85b2e1a37b417f00be7ec6123/src/loaders/postcss/config.ts#L32

to something like

import TypeScriptLoader from '@endemolshinegroup/cosmiconfig-typescript-loader';

const found: Found | null = await cosmiconfig("postcss", {
  loaders: {
    '.ts': TypeScriptLoader
  }
}).search(searchPath);