npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ueberbit/vite-plugin-drupal

v0.6.0-beta.12

Published

## Install

Downloads

716

Readme

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

vite.config.ts

import { defineConfig } from 'vite'
import uebertool from '@ueberbit/vite-plugin-drupal'

export default defineConfig({
  plugins: [
    uebertool()
  ],
})

add js/main.ts and css/tailwind.css to your theme and you are good to go.

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.*.

SDC

Drupal automatically attaches the css and js file with the same name as the sdc. Thus you can add the files you want to be transpiled to the assets, src, js or css folder.

The resulting library will be attached by the companion module.

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.

| mode | description | |---------|-----------------------------------------------------------| | eager | imported in main bundle (you most likely don't want this) | | idle | dynamic import when browser is idle | | lazy | dynamic import | | visible | dynamic 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

(uebertool_cascade_layer does this for you)

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)