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

There is any way to implement postcss.config.js #11

Closed
anish2690 opened this issue Jun 18, 2020 · 2 comments
Closed

There is any way to implement postcss.config.js #11

anish2690 opened this issue Jun 18, 2020 · 2 comments

Comments

@anish2690
Copy link
Contributor

trying to use tailwidncss
https://tailwindcss.com/docs/installation/#using-tailwind-with-postcss

postcss.config.js
module.exports = {
  plugins: [
    // ...
    require('tailwindcss'),
    require('autoprefixer'),
    // ...
  ]
}

thanks in advance, I appreciate if you can provide a code sample

@lzxb
Copy link
Contributor

lzxb commented Jun 18, 2020

import { Plugin, PostcssOptions } from '@fmfe/genesis-core';

export class PostcssPlugin extends Plugin {
    public postcss(config: PostcssOptions) {
        config.plugins.push({
            // 插件
        });
    }
}

genesis.dev.ts and genesis.build.ts use this plug-in

ssr.plugin.use(PostcssPlugin);

@lzxb
Copy link
Contributor

lzxb commented Jun 18, 2020

In the production environment, the following configurations are enabled by default

            postcssConfig.plugins.push(
                ...[
                    postcssPresetEnv({
                        browsers: ssr.getBrowsers('client')
                    }),
                    cssnano({
                        preset: [
                            'default',
                            {
                                mergeLonghand: false,
                                cssDeclarationSorter: false
                            }
                        ]
                    })
                ]
            );

@lzxb lzxb closed this as completed Jun 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants