Coder Social home page Coder Social logo

mubaidr / vite-vue3-chrome-extension-v3 Goto Github PK

View Code? Open in Web Editor NEW
383.0 4.0 49.0 733 KB

Another vite powered web extension (chrome, firefox, etc.) starter template.

JavaScript 7.57% TypeScript 51.33% HTML 6.90% Vue 30.52% SCSS 3.68%
chrome extension vite vue3 webextension hacktoberfest

vite-vue3-chrome-extension-v3's Introduction

vite-vue3-browser-extension-v3

build release

A Vite powered WebExtension (Chrome, FireFox, etc.) starter template based on manifest 3, vue3 and vite.

For a basic template, check out: : vite-chrome-extension

Features

  • Vue 3 - Composition API, Script setup and more!
  • Vue 3 app in Content Script too (template added)
  • Vue devtools support
  • HMR for extension pages and content scripts, with Firefox support
  • Sample onInstall & onUpdate pages
  • Tailwind css And daisyUI
  • Tailwindcss plugins for Typography, forms, prettier and daisy ui
  • Vue Router setup incuding unplugin-vue-router for automatic route registration
  • vscode recommended settings and extensions for chrome plugin development
  • Effortless communications - powered by webext-bridge
  • Components auto importing
  • Icons - Access to icons from any iconset directly
  • TypeScript - type safe
  • Eslint & Prettier configured for vue, javascript, TypeScript
  • CRXJS Vite Plugin Build a Chrome Extension with Vite
  • Github build and release actions

Please create an issue if you feel some feature is missing or could be improved.

Pre-packed

Vite Plugins

Vue Plugins

  • Pinia - Intuitive, type safe, light and flexible Store for Vue
  • VueUse - collection of useful composition APIs

Plugins

  • Marked - A markdown parser and compiler. Used for CHANGELOG.md to show in Update page

UI Frameworks

  • tailwindcss - A utility-first CSS framework
  • daisyUI - The most popular component library for Tailwind CSS

Tailwind css forms and typography plugins are enabled for default styling of form controls.

WebExtension Libraries

Coding Style

Use the Template

GitHub Template

Create a repo from this template on GitHub.

Clone to local

If you prefer to do it manually with the cleaner git history

If you don't have pnpm installed, run: npm install -g pnpm

pnpx degit mubaidr/vite-vue3-chrome-extension-v3 my-webext
cd my-webext
pnpm i

Usage

Project Structure

  • src - main source.
    • content-script - scripts and components to be injected as content_script
      • iframe content script iframe vue3 app which will be injected into page
    • background - scripts for background.
    • popup - popup vuejs application root
      • pages - popup pages
    • options - options vuejs application root
      • pages - options pages
    • setup - Page for Install and Update chrome extension events
      • pages - pages for install and update events
    • offscreen - Chrome extension offscreen pages, can be used for audio, screen recording
    • pages - application pages, common to all views (About, Contact, Authentication etc)
    • components - auto-imported Vue components that are shared in popup and options page.
    • assets - assets used in Vue components
  • dist - built files
    • chrome - Chrome extension
    • firefox - Firefox extension

Browser Related Configurations

  • manifest.config.ts - Base extension manifest with common configuration
  • manifest.chrome.config.ts - Chrome specific manifest
  • manifest.firefox.config.ts - Firefox spefic manifest
  • vite.config.ts - Base vite configuration
  • vite.chrome.config.ts - Chrome specific vite configuration
  • vite.firefox.config.ts - Firefox specific vite configuration

Scripts

  • pnpm dev - Start development server
  • pnpm build - Build extension
  • pnpm lint - Lint files

You can also use pnpm dev:chrome, pnpm dev:firefox, pnpm build:chrome, pnpm build:firefox, pnpm lint:fix

Extra info

In src/background/index.ts you can find an example of chrome.runtime.onInstalled.addListener.

We add ?type to the url to tell if it's update or install event. Then in src/setup/pages/index.ts we check for the type and show the appropriate page.

Development

pnpm dev

Then load extension in browser with the dist/ folder.

Build

To build the extension, run

pnpm build

And then pack files under dist/chrome or dist/firefox, you can upload to appropriate extension store.

Contributors

mubaidr
Muhammad Ubaid Raza
ultimateshadsform
Alexander
baramofme
Jihoon Yi
poncianodiego
Diego Ponciano
justorez
Null

Credits

This template is heavenly inspired by: https://github.com/antfu/vitesse-webext

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.