bud.config.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * Compiler configuration
  3. *
  4. * @see {@link https://roots.io/docs/sage sage documentation}
  5. * @see {@link https://bud.js.org/guides/configure bud.js configuration guide}
  6. *
  7. * @param {import('@roots/bud').Bud} app
  8. */
  9. export default async (app) => {
  10. /**
  11. * Application assets & entrypoints
  12. *
  13. * @see {@link https://bud.js.org/docs/bud.entry}
  14. * @see {@link https://bud.js.org/docs/bud.assets}
  15. */
  16. app
  17. .entry('app', ['@scripts/app', '@styles/app'])
  18. .entry('editor', ['@scripts/editor', '@styles/editor'])
  19. .assets(['images']);
  20. /**
  21. * Set public path
  22. *
  23. * @see {@link https://bud.js.org/docs/bud.setPublicPath}
  24. */
  25. app.setPublicPath('/app/themes/sage/public/');
  26. /**
  27. * Development server settings
  28. *
  29. * @see {@link https://bud.js.org/docs/bud.setUrl}
  30. * @see {@link https://bud.js.org/docs/bud.setProxyUrl}
  31. * @see {@link https://bud.js.org/docs/bud.watch}
  32. */
  33. app
  34. .setUrl('http://localhost')
  35. .setProxyUrl('http://example.test')
  36. .watch(['resources/views', 'app']);
  37. /**
  38. * Generate WordPress `theme.json`
  39. *
  40. * @note This overwrites `theme.json` on every build.
  41. *
  42. * @see {@link https://bud.js.org/extensions/sage/theme.json}
  43. * @see {@link https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-json}
  44. */
  45. app.wpjson
  46. .set('settings.color.custom', false)
  47. .set('settings.color.customDuotone', false)
  48. .set('settings.color.customGradient', false)
  49. .set('settings.color.defaultDuotone', false)
  50. .set('settings.color.defaultGradients', false)
  51. .set('settings.color.defaultPalette', false)
  52. .set('settings.color.duotone', [])
  53. .set('settings.custom.spacing', {})
  54. .set('settings.custom.typography.font-size', {})
  55. .set('settings.custom.typography.line-height', {})
  56. .set('settings.spacing.padding', true)
  57. .set('settings.spacing.units', ['px', '%', 'em', 'rem', 'vw', 'vh'])
  58. .set('settings.typography.customFontSize', false)
  59. .useTailwindColors()
  60. .useTailwindFontFamily()
  61. .useTailwindFontSize()
  62. .enable();
  63. };