0.3.8 • Published 2 months ago

@ueberbit/vite-plugin-drupal v0.3.8

Weekly downloads
-
License
-
Repository
-
Last release
2 months ago

Vite Plugin Drupal

Install

Add it to your theme with:

pnpm i -D @ueberbit/vite-plugin-drupal

Features

  • automagic asset bundling
  • batteries included:
    • preconfigured for tailwind and postcss
    • alpinejs is autoinjected when it is used
  • breakpoint.yml generation
  • automagic generation of libraries.yml
  • autodetection of drupal dependencies
  • wrapping of tailwind layers in cascade layers
  • autoimport of js/ts files (unimport)
  • autoimport of vue components (unplugin-vue-components)
  • hmr for twig
  • hmr of tailwind inside vue custom elements
  • automatic import and defining of custom elements for best performance (lazy, idle, eager, visible)

Usage

Entrypoints

Every js/ts and css file inside:

./js
./css
./templates/

is an entrypoint and also a drupal library. An exception to this are files inside

./js/composables
./js/stores
./js/utils

, files starting with an _underscore and file ending with *.ce.*.

Custom Element Loader

Files ending with *.{eager|idle|lazy|visible}.ce.* are auto injected by the custom element loader. Any of these files is auto imported and registered as <themename>-filename.

modedescription
eagerimported in main bundle (you most likely don't want this)
idledynamic import when browser is idle
lazydynamic import
visibledynamic import when element is close to the viewport

Custom Element Data

Custom Element Data is exported into .uebertool
You can add it to vscode with:

"html.customData": [
  ".uebertool/vscode.html-custom-data.json"
]

CSS

Cascade Layers

Tailwind Layers are wrapped in cascade layers by dafault. Drupal styles should be wrapped with

@layer drupal

You can disable this with:

css: {
  cascadeLayers: false
}

Drupal Layers

When a css file include {base|layout|component|state|theme} in the name

Breakpoints

The breakpoint.yml uses the breakpoints from your tailwind config file. Per Default it offers 1x and 2x multiplier.

Libraries

A libraries.yml is automagically generated. Used Drupal dependencies are added for ease of use.

The libraries of:

./js/main.{ts|js}
./css/tailwind.css
./css/gin-custom.css

Are global by default.

Types

Drupal types are available. Including types for some internals like drupal/once.

Konami

Do fun stuff with konami code:

document.addEventListener('konami', funStuff)
0.3.8

2 months ago

0.3.6

2 months ago

0.3.7

2 months ago

0.3.6-beta.8

2 months ago

0.3.6-beta.7

2 months ago

0.3.6-beta.6

3 months ago

0.3.6-beta.5

3 months ago

0.3.6-beta.4

4 months ago

0.3.6-beta.3

4 months ago

0.3.5

4 months ago

0.1.0-beta.3

10 months ago

0.1.0-beta.5

10 months ago

0.1.0-beta.4

10 months ago

0.1.0-beta.1

10 months ago

0.1.0-beta.10

9 months ago

0.1.0-beta.12

8 months ago

0.1.0-beta.11

8 months ago

0.1.0-beta.7

9 months ago

0.1.0-beta.6

10 months ago

0.1.0-beta.9

9 months ago

0.1.0-beta.8

9 months ago

0.1.0

8 months ago

0.3.0

5 months ago

0.2.1

7 months ago

0.1.2

7 months ago

0.2.0

7 months ago

0.3.2

5 months ago

0.3.1

5 months ago

0.2.2

7 months ago

0.3.4

5 months ago

0.3.3

5 months ago

0.0.20

11 months ago

0.0.21

11 months ago

0.0.15

1 year ago

0.0.16

1 year ago

0.0.17

1 year ago

0.0.18

1 year ago

0.0.19

1 year ago

0.0.11

1 year ago

0.0.12

1 year ago

0.0.13

1 year ago

0.0.14

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.6

1 year ago

0.0.7

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago