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

Allow import customisation #154

Open
isshesure opened this issue Jun 20, 2024 · 1 comment
Open

Allow import customisation #154

isshesure opened this issue Jun 20, 2024 · 1 comment
Assignees
Labels
API Design package: system Specific to @mui/system

Comments

@isshesure
Copy link

isshesure commented Jun 20, 2024

Summary

Allow the styles import to be customised, so that component libraries can abstract away the underlying styling solution.

Examples

const { withPigment } = require('@pigment-css/nextjs-plugin');

module.exports = withPigment({
  importName: '@mycompany/styles.css'
})(nextJsConfig);

Then:

 import type { Metadata } from 'next';
+import '@mycompany/styles.css';

 export const metadata: Metadata = {
   title: 'Create Next App',
   description: 'Generated by create next app',
 };

 export default function RootLayout(props: { children: React.ReactNode }) {
   return (
     <html lang="en">
       <body>{props.children}</body>
     </html>
   );
 }

Then libraries can export their own plugin:

export const withMyCompanyLibrary = withPigment({ importName: '@mycompany/styles.css' })

Motivation

Avoid exposing Pigment CSS usage as the styling mechanism for those libraries that do not use other Pigment CSS consumer facing features.

Search keywords: import customisation

@isshesure isshesure added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 20, 2024
@zannager zannager added the package: system Specific to @mui/system label Jun 20, 2024
@brijeshb42
Copy link
Contributor

Sounds like a nice addition to the current options. I'll mark this to be taken into consideration before our stable release.

@brijeshb42 brijeshb42 removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design package: system Specific to @mui/system
Projects
None yet
Development

No branches or pull requests

3 participants