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

vue-cli-plugin-drupal-pdb

v0.1.0

Published

Vue CLI 3 plugin for Drupal Progressively Decoupled Blocks

Downloads

310

Readme

Vue CLI 3 plugin for Drupal Progressively Decoupled Blocks

You can now easily generate PDB Vue blocks for Drupal via the Vue CLI. This means that you can do your Vue development like you would on most any project with Single File Components.

Getting Started

  1. Make sure that Vue CLI 3 is installed. https://cli.vuejs.org/guide/installation.html

  2. Add this plugin

vue add vue-cli-plugin-drupal-pdb
  1. Follow the prompts and choose Initial framework and first block to generate scaffolding and an initial block.

  2. Answer the remaining prompts.

Creating a new Block

(Assuming the initial framework has been generated) to create a new block you can invoke the plugin again and then choose New Block from the prompt.

vue invoke vue-cli-plugin-drupal-pdb

Choose the Framework Mode type of PDB blocks to create

Mode: Per-block Vue instances

Each block will be its own Vue instance. This is the safest for working with Drupal when there will be other javascript working on the site in addition to Vue. Each instance can still have whatever child components it likes.

Each block will live within its own named directory inside a parent blocks directory.

One thing to note is that this file structure is different than the one initially created by Vue CLI. This means that adding other plugins via the CLI like Vuex or Router may still need to be manually wired up after installation since the CLI will not understand this new structure when it tries to modify files.

Mode: "SPA" single page app

Each block will be a globally registered Vue Component. This means that blocks can interact with libraries like Vuex for state management between blocks. The danger of this mode is that it could cause problems with other normal Drupal blocks using Javascript.

Each block will be register in a *.info.yml file in the blocks directory. This directory will only contain info files since all the javascript will be in the main src directory.

Library files

By default, a *.libraries.yml file will be created. This file should be moved into the root directory of the module or theme that your PDB Vue blocks are being created in. However, if this file already exists, simply copy the contents and paste them into the existing file. The file generated for you can then be deleted. In other words, you should only have one of these files in your theme or module.

Update the scripts and css path

The generated *.libraries.yml file also assumes that the directory of all your PDB Vue blocks is called pdb_vue. So the path in this file should be updated to whatever the real path of those scripts is.