primefaces / primevue-nuxt-module

MIT License
73 stars 11 forks source link

Add `importPT` option to module config #11

Closed mertsincan closed 1 year ago

mertsincan commented 1 year ago

Users want to set their own custom presets or ready-made presets in nuxt.config. Due to some limitations (Ref: https://github.com/primefaces/primevue-nuxt-module/issues/6#issuecomment-1772954754), the importPT option can be used instead of options.pt.

Usage:

// nuxt.config.js
primevue: {
  importPT: { as: <Default_Export_As_String>, from: <Package_Path> },
  ...
}

Example 1:

// nuxt.config.js
primevue: {
  importPT: { as: 'Tailwind', from: 'primevue/passthrough/tailwind' },
  ...
}

Example 2:

// nuxt.config.js
import path from 'path';
...

primevue: {
  importPT: { as: 'CustomTailwind', from: path.resolve(__dirname, './assets/presets/custom.js')}
  ...
}
// assets/presets/custom.js

const CustomTailwind = {
    ...
    button: {
        root: 'my-button',
       ...
    },
    ...
}

export default CustomTailwind;
rogrile commented 11 months ago

Could you provide a working example in nuxt with Tailwind PT? For me this doesn't work for some reason.

mertsincan commented 11 months ago

Sorry for the delayed response. Please see; https://github.com/primefaces/primevue-examples/blob/main/nuxt-unstyled-tailwind/nuxt.config.ts