Earlene  Rowe

Earlene Rowe

1593805500

Creating and Publishing Multiple Vue Web and Library Components

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 work with the new components and see it in action

I know most developers want to get on the gist right away, so let’s start.


Initial Setup

Pre-requisites

Make sure first that vue cli and vue cli-service-global was installed globally. They will be use on building packages and serving components

npm install -g @vue/cli @vue/cli-service-global

Create a vue project

vue create dxc-components

It will prompt you with some setup options, you should just choose “default” and hit enter.


Build Targets

We have to specify our build configurations and to do that, we need to make changes on package.json. In scripts, update that portion to have it like this —

"scripts": {
     "serve": "vue-cli-service serve",
     "build": "npm run build:wc & npm run build:lib",
     "lint": "vue-cli-service lint",
     "build:lib": "vue-cli-service build --target lib --name dxc-components 'src/main.js'",
     "build:wc": "vue-cli-service build --target wc --name dxc-components 'src/components/*.vue'"
   },

build:lib will build our package designed for library use. Example

import MyComponent from 'my-component';  

export default {
   components: {
       MyComponent,   
   },
  // rest of the component 
}

build:wc will allow usage via <script> tag directly in the browser . Example

<script src="https://unpkg.com/vue"></script> <script src="https://unpkg.com/my-component"></script>
... 
<my-component></my-component> 
...

the 'src/components/*.vue' , is the entry that will register multiple components found insrc/components directory. In our configuration,--name was set to dxc-components , with that, the result of the bundle will be registered as <dxc-components-my-component> . That is, if we have a component named MyComponent.vue in src/components .

**Note! **When you only have one component inside src/components the --name will be use as the tag element name. So, the resulting element will be <dxc-components /> instead of <dxc-components-my-component />

The build on script commands will allow us to easily build both lib and web components.

#npm #web-components #vue #components-library

What is GEEK

Buddha Community

Creating and Publishing Multiple Vue Web and Library Components
Earlene  Rowe

Earlene Rowe

1593805500

Creating and Publishing Multiple Vue Web and Library Components

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 work with the new components and see it in action

I know most developers want to get on the gist right away, so let’s start.


Initial Setup

Pre-requisites

Make sure first that vue cli and vue cli-service-global was installed globally. They will be use on building packages and serving components

npm install -g @vue/cli @vue/cli-service-global

Create a vue project

vue create dxc-components

It will prompt you with some setup options, you should just choose “default” and hit enter.


Build Targets

We have to specify our build configurations and to do that, we need to make changes on package.json. In scripts, update that portion to have it like this —

"scripts": {
     "serve": "vue-cli-service serve",
     "build": "npm run build:wc & npm run build:lib",
     "lint": "vue-cli-service lint",
     "build:lib": "vue-cli-service build --target lib --name dxc-components 'src/main.js'",
     "build:wc": "vue-cli-service build --target wc --name dxc-components 'src/components/*.vue'"
   },

build:lib will build our package designed for library use. Example

import MyComponent from 'my-component';  

export default {
   components: {
       MyComponent,   
   },
  // rest of the component 
}

build:wc will allow usage via <script> tag directly in the browser . Example

<script src="https://unpkg.com/vue"></script> <script src="https://unpkg.com/my-component"></script>
... 
<my-component></my-component> 
...

the 'src/components/*.vue' , is the entry that will register multiple components found insrc/components directory. In our configuration,--name was set to dxc-components , with that, the result of the bundle will be registered as <dxc-components-my-component> . That is, if we have a component named MyComponent.vue in src/components .

**Note! **When you only have one component inside src/components the --name will be use as the tag element name. So, the resulting element will be <dxc-components /> instead of <dxc-components-my-component />

The build on script commands will allow us to easily build both lib and web components.

#npm #web-components #vue #components-library

Luna  Mosciski

Luna Mosciski

1600583123

8 Popular Websites That Use The Vue.JS Framework

In this article, we are going to list out the most popular websites using Vue JS as their frontend framework.

Vue JS is one of those elite progressive JavaScript frameworks that has huge demand in the web development industry. Many popular websites are developed using Vue in their frontend development because of its imperative features.

This framework was created by Evan You and still it is maintained by his private team members. Vue is of course an open-source framework which is based on MVVM concept (Model-view view-Model) and used extensively in building sublime user-interfaces and also considered a prime choice for developing single-page heavy applications.

Released in February 2014, Vue JS has gained 64,828 stars on Github, making it very popular in recent times.

Evan used Angular JS on many operations while working for Google and integrated many features in Vue to cover the flaws of Angular.

“I figured, what if I could just extract the part that I really liked about Angular and build something really lightweight." - Evan You

#vuejs #vue #vue-with-laravel #vue-top-story #vue-3 #build-vue-frontend #vue-in-laravel #vue.js

Sofia Kelly

Sofia Kelly

1578061020

10 Best Vue Icon Component For Your Vue.js App

Icons are the vital element of the user interface of the product enabling successful and effective interaction with it. In this article, I will collect 10 Vue icon component to bring more interactivity, better UI design to your Vue application.

1. Animated SweetAlert Icons for Vue

A clean and simple Vue wrapper for SweetAlert’s fantastic status icons. This wrapper is intended for users who are interested in just the icons. For the standard SweetAlert modal with all of its bells and whistles, you should probably use Vue-SweetAlert 2

Animated SweetAlert Icons for Vue

Demo: https://vue-sweetalert-icons.netlify.com/

Download: https://github.com/JorgenVatle/vue-sweetalert-icons/archive/master.zip

2. vue-svg-transition

Create 2-state, SVG-powered animated icons.

vue-svg-transition

Demo: https://codesandbox.io/s/6v20q76xwr

Download: https://github.com/kai-oswald/vue-svg-transition/archive/master.zip

3. Vue-Awesome

Awesome SVG icon component for Vue.js, with built-in Font Awesome icons.

Vue-Awesome

Demo: https://justineo.github.io/vue-awesome/demo/

Download: https://github.com/Justineo/vue-awesome/archive/master.zip

4. vue-transitioning-result-icon

Transitioning Result Icon for Vue.js

A scalable result icon (SVG) that transitions the state change, that is the SVG shape change is transitioned as well as the color. Demonstration can be found here.

A transitioning (color and SVG) result icon (error or success) for Vue.

vue-transitioning-result-icon

Demo: https://transitioning-result-icon.dexmo-hq.com/

Download: https://github.com/dexmo007/vue-transitioning-result-icon/archive/master.zip

5. vue-zondicons

Easily add Zondicon icons to your vue web project.

vue-zondicons

Demo: http://www.zondicons.com/icons.html

Download: https://github.com/TerryMooreII/vue-zondicons/archive/master.zip

6. vicon

Vicon is an simple iconfont componenet for vue.

iconfont
iconfont is a Vector Icon Management & Communication Platform made by Alimama MUX.

vicon

Download: https://github.com/Lt0/vicon/archive/master.zip

7. vue-svgicon

A tool to create svg icon components. (vue 2.x)

vue-svgicon

Demo: https://mmf-fe.github.io/vue-svgicon/v3/

Download: https://github.com/MMF-FE/vue-svgicon/archive/master.zip

8. vue-material-design-icons

This library is a collection of Vue single-file components to render Material Design Icons, sourced from the MaterialDesign project. It also includes some CSS that helps make the scaling of the icons a little easier.

vue-material-design-icons

Demo: https://gitlab.com/robcresswell/vue-material-design-icons

Download: https://gitlab.com/robcresswell/vue-material-design-icons/tree/master

9. vue-ionicons

Vue Icon Set Components from Ionic Team

Design Icons, sourced from the Ionicons project.

vue-ionicons

Demo: https://mazipan.github.io/vue-ionicons/

Download: https://github.com/mazipan/vue-ionicons/archive/master.zip

10. vue-ico

Dead easy, Google Material Icons for Vue.

This package’s aim is to get icons into your Vue.js project as quick as possible, at the cost of all the bells and whistles.

vue-ico

Demo: https://material.io/resources/icons/?style=baseline

Download: https://github.com/paulcollett/vue-ico/archive/master.zip

I hope you like them!

#vue #vue-icon #icon-component #vue-js #vue-app

Vue 3 UX Wins with Async Components & Suspense

Lazy loading components is a easy way to improve the user experience of your app especially if your code bundle is big or if users are on slow connections.

Vue 3 has introduced several new features to help you achieve this easily and with great UX through the improvements to the async component API and the new Suspense component.


Why lazy load components?

Some parts of your UI don’t need to be loaded the instant a user visits your app, for example, dynamic UI features like modals and tooltips, etc. And, if you’re using the single-page app architecture, page content on unseen pages shouldn’t be loaded until needed either.

You can get an easy performance win by “lazy loading” the components that contain such features and content. This means the code for these components is not included in the initial code bundle sent to a user and is instead loaded on demand.

Example scenario

In this example app, our app displays a component ChatWindow which loads if the user is authenticated.

The details aren’t important, but let’s assume authentication can only be determined at runtime, and that this component is big and bulky. For these reasons, we may want to lazy load it.

App.vue

<template>
  <h3>Chat with friends here</h3>
  <chat-window v-if="auth" />
</template>
<script>
import ChatWindow from "@/components/ChatWindow";

export default {
  components: {
    ChatWindow
  },
  ...
}
</script>

Lazy loading with Vue 3 async component API

Vue 3 has introduced the defineAsyncComponent API which makes it very simple to lazy load a component.

All you need to do is pass a function to the constructor that loads your component. Assuming you’re bundling your code with Webpack or something similar, the easiest way to do this is to use the dynamic import feature (import) which will ensure your component is built into a separate file and loaded only when called upon.

<script>
import { defineAsyncComponent } from "vue";

const ChatWindow = defineAsyncComponent(
  () => import("@/components/ChatWindow")
);

export default {
  components: {
    ChatWindow
  },
  ...
}
</script>

When this app is built, you’ll see any dynamically imported component as a separate file in your build.

File                                 Size

dist/js/chunk-vendors.f11402df.js    82.39 KiB
dist/js/app.ada103fb.js              20.59 KiB
dist/js/ChatWindow.3c1708e4.js       5.47 KiB
dist/css/app.8221c481.css            1.76 KiB
dist/css/ChatWindow.f16731cd.css     2.75 KiB

For more info on how this works, see my previous article Code Splitting With Vue.js And Webpack.

#vue.js #components #web performance #vue #vue 3 #programming

Henry Short

Henry Short

1578472348

7 Best Vue Highlight Component for Your Vue App

Vue highlight is often used to highlight text and syntax. Here are the 7 Vue highlight components I’ve collected.

1. vue-snippets

Vue3 Snippets, This extension adds Vue3 Code Snippets into Visual Studio Code.

vue-snippets

Download


2. vim-vue-plugin

Vim syntax and indent plugin for vue files

vim-vue-plugin

Download


3. vue-highlighter

Vue directive for highlight multiple istances of a word.

vue-highlighter

Download


4. vue-code-highlight

Beautiful code syntax highlighting as Vue.js component.

vue-code-highlight

Download


5. Vue Prism Editor

A dead simple code editor with syntax highlighting and line numbers. 7kb/gz

Features

  • Code Editing ^^
  • Syntax highlighting
  • Undo / Redo
  • Copy / Paste
  • The spaces/tabs of the previous line is preserved when a new line is added
  • Works on mobile (thanks to contenteditable)
  • Resize to parent width and height
  • Support for line numbers
  • Support for autosizing the editor
  • Autostyling the linenumbers(optional)

Vue Prism Editor

Demo

Download


6. vue-highlight-words

A simple port from react-highlight-words

Vue component to highlight words within a larger body of text.

vue-highlight-words

Demo

Download


7. vue-highlight-text

Vue component for highlight multiple istances of a word.

vue-highlight-text

Demo

Download


Thank for read!

#vue-highlight #vue #vue-highlight-component #highlight-vue