Photo by HalGatewood.com on Unsplash

I enjoyed writing my last story where I shared about using Alpine.js on color scheme switching. And now, I’ll be sharing another Alpin.js + Tailwind series, but this time — creating a custom select field.

Once you’re done following this article, you’ll see something like this.


Photo by Kelli Tungay on Unsplash

As we start building a website, at some point we would wonder what will we use as our color theme. In demo sites, they usually provide such feature where user can toggle different color schemes and let them decide what they prefer. Thence, this post, is another attempt on implementing such feature.

Prepare our Web Layout

So, to start, open up your terminal and let’s create a new folder with our main html file and our assets folders.

mkdir theming && cd theming && touch index.html && mkdir -p assets/{css,js}

In the index.html file let’s add a very simple html content for our layout.


Photo by Alex Knight on Unsplash

We know about Jarvis from Iron Man. He is very reliable indeed. Although, we can pleasantly want to own a Jarvis, we can start creating simple CLI that you can customize for your own simple needs. With that, we can use oclif. oclif is a framework for building CLIs in Node. It is extensible and customizable to cater developers’ needs either for tooling or just for fun. We will witness some of its prowess in a short while.

To begin, let me show the priorities that we will be covering for this article —

  • Multi-command CLI
  • Working on different commands


While working on a new vue project for a future tooling using web/lib components (I have written about creating web/lib components here), I have decided to use typescript. With that, I used the @vue/cli-plugin-typescript knowing obliviously that I won’t be having troubles doing any configurations and initial setup to work seamlessly with vue. Since I’m working for web/lib components, I needed to serve the component and see it in action. But this becomes the part that I had struggled with — I could not get it work when serving the single vue file. I’ve been getting an error about processing…


I’ve been reading around on articles about creating vue web/lib components. However, I could not find one handling multiple components. There is also a little emphasis on producing different target builds — the Library and Web Components. Thence, here it is — my attempt to share my experience setting up a multiple web and library components using vue.

On this reading, we will cover the following parts:

  • Configuring two target builds: Web and Library builds
  • Handling multiple components
  • Publishing the vue components as a scoped package to npm
  • Bonus — usage of the new published package
  • Bonus — how to…

Dixie Atay

Programmer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store