All Projects โ†’ adambullmer โ†’ Vue Cli Plugin Browser Extension

adambullmer / Vue Cli Plugin Browser Extension

Licence: lgpl-3.0
Browser extension development plugin for vue-cli 3.0

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue Cli Plugin Browser Extension

Vue Cli Plugin Qiankun
๐Ÿš€ qiankun plugin for vue-cli
Stars: โœญ 151 (-36.55%)
Mutual labels:  vue-cli, plugin
Vue Plugin Boilerplate
๐Ÿ”ฉ Boilerplate for Vue.js plugin
Stars: โœญ 143 (-39.92%)
Mutual labels:  vue-cli, plugin
Vue Cli Plugin P11n
๐Ÿ”Œ Vue CLI 3 plugin to pluginize your Vue project
Stars: โœญ 117 (-50.84%)
Mutual labels:  vue-cli, plugin
Vue Cli Plugin I18n
๐ŸŒ Vue CLI plugin to add vue-i18n to your Vue Project
Stars: โœญ 172 (-27.73%)
Mutual labels:  vue-cli, plugin
Awesome Xcode Extensions
Awesome native Xcode extensions.
Stars: โœญ 2,628 (+1004.2%)
Mutual labels:  plugin
Vuemmerce
๐Ÿ‘‰ Responsive ecommerce template ๐Ÿ›’ built with Vue.js and Nuxt.js
Stars: โœญ 223 (-6.3%)
Mutual labels:  vue-cli
Caddy Authz
Caddy-authz is a middleware for Caddy that blocks or allows requests based on access control policies.
Stars: โœญ 221 (-7.14%)
Mutual labels:  plugin
Tinyfaces Sketch Plugin
Fill selected layers in Sketch with free stock avatars
Stars: โœญ 221 (-7.14%)
Mutual labels:  plugin
Cato
Spotlight and alfred app like search in your browser ๐Ÿ”.
Stars: โœญ 237 (-0.42%)
Mutual labels:  browser-extension
Vue Events
Simple event handling for Vue.js
Stars: โœญ 234 (-1.68%)
Mutual labels:  plugin
Ctrlp Py Matcher
Fast vim CtrlP matcher based on python
Stars: โœญ 229 (-3.78%)
Mutual labels:  plugin
Vim Yoink
Vim plugin that maintains a yank history to cycle between when pasting
Stars: โœญ 225 (-5.46%)
Mutual labels:  plugin
Miaow
A set of plugins for Sketch include drawing links & marks, UI Kit & Color sync, font & text replacing.
Stars: โœญ 2,536 (+965.55%)
Mutual labels:  plugin
Intro To Vue
Workshop Materials for my Introduction to Vue.js Workshop
Stars: โœญ 2,668 (+1021.01%)
Mutual labels:  vue-cli
Renren Fast Vue
renren-fast-vueๅŸบไบŽvueใ€element-uiๆž„ๅปบๅผ€ๅ‘๏ผŒๅฎž็Žฐrenren-fastๅŽๅฐ็ฎก็†ๅ‰็ซฏๅŠŸ่ƒฝ๏ผŒๆไพ›ไธ€ๅฅ—ๆ›ดไผ˜็š„ๅ‰็ซฏ่งฃๅ†ณๆ–นๆกˆใ€‚
Stars: โœญ 2,779 (+1067.65%)
Mutual labels:  vue-cli
Protoc Gen Lint
A plug-in for Google's Protocol Buffers (protobufs) compiler to lint .proto files for style violations.
Stars: โœญ 221 (-7.14%)
Mutual labels:  plugin
Vue Admin
ๅŸบไบŽand-design-vue็š„vueๅŽๅฐ็ฎก็†็ณป็ปŸๆจกๆฟ
Stars: โœญ 226 (-5.04%)
Mutual labels:  vue-cli
Wordpress Plugin Boilerplate Tutorial
Tutorials and Examples for WordPress Plugin Boilerplate, a foundation for WordPress Plugin Development.
Stars: โœญ 232 (-2.52%)
Mutual labels:  plugin
Refined Github
Browser extension that simplifies the GitHub interface and adds useful features
Stars: โœญ 16,446 (+6810.08%)
Mutual labels:  browser-extension
Craftbook
๐Ÿ”ง Machines, ICs, PLCs, and more!
Stars: โœญ 226 (-5.04%)
Mutual labels:  plugin

vue-cli-plugin-browser-extension

Browser extension development plugin for vue-cli 3.x

What does it do?

This is intended to be a [email protected] replacement for Kocal/vue-web-extension v1 (now, Kocal/vue-web-extension is a preset using this plugin).

This plugin changes the serve command for your vue applications. This new command is only for running a livereload server while testing out your browser extension.

This removes the entrypoint of src/main.js, and as such will not scaffold a general vue app.

Packaging and deploying will still be done with yarn build and zipping in up for Chrome, Firefox, or whichever other browser you wish to develop for.

It makes some assumptions about your project setup. I hope to be able to scaffold an app so that identifying the below in unnecessary.

.
โ”œโ”€โ”€ public/
โ”‚   โ”œโ”€โ”€ _locales/
โ”‚   โ”‚   โ””โ”€โ”€ en/
โ”‚   โ”‚       โ””โ”€โ”€ messages.json
โ”‚   โ”œโ”€โ”€ icons/
โ”‚   โ”‚   โ””โ”€โ”€ Icons for your extension. Should include a 16, 19, 38, 48, and 128px square image
โ”‚   โ””โ”€โ”€ browser-extension.html (default target html template)
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ assets/
โ”‚   โ”‚   โ””โ”€โ”€ Static assets in use in your app, like logo.png
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ””โ”€โ”€ HelloWorld.vue (modified)
โ”‚   โ”œโ”€โ”€ content-scripts
โ”‚   โ”‚   โ””โ”€โ”€ content-script.js
โ”‚   โ”œโ”€โ”€ devtools/ (asked during project generation)
โ”‚   โ”‚   โ”œโ”€โ”€ App.vue
โ”‚   โ”‚   โ””โ”€โ”€ main.js
โ”‚   โ”œโ”€โ”€ options/ (asked during project generation)
โ”‚   โ”‚   โ”œโ”€โ”€ App.vue
โ”‚   โ”‚   โ””โ”€โ”€ main.js
โ”‚   โ”œโ”€โ”€ popup/ (asked during project generation)
โ”‚   โ”‚   โ”œโ”€โ”€ App.vue
โ”‚   โ”‚   โ””โ”€โ”€ main.js
โ”‚   โ”œโ”€โ”€ override/ (asked during project generation)
โ”‚   โ”‚   โ”œโ”€โ”€ App.vue
โ”‚   โ”‚   โ””โ”€โ”€ main.js
โ”‚   โ””โ”€โ”€ standalone/ (asked during project generation)
โ”‚      โ”œโ”€โ”€ App.vue
โ”‚      โ””โ”€โ”€ main.js
โ”œโ”€โ”€ background.js
โ””โ”€โ”€ manifest.json

System Dependencies

If you wish to use the signing key functionality you will need to have openssl available on your system.

Adding to your project

This can be added to your vuejs project by one of the following methods:

  • Using the vue ui and searching for this project
  • Using the vue cli vue add browser-extension command

Usage

Running the Livereload server. This will build and write to the local dist directory.

This plugin will respect the outputDir setting, however it cannot read into passed CLI args, so if you require a custom output dir, be sure to add it in your vue.config.js file. You can then add this as an unpacked plugin to your browser, and will continue to update as you make changes.

NOTE: you cannot get HMR support in the popup window, however, closing and reopening will refresh your content.

yarn serve
yarn build

Plugin options

Plugin options can be set inside your vue.config.js:

// vue.config.js
module.exports = {
  pluginOptions: {
    browserExtension: {
      // options...
    },
  },
};
  • components

    • Type: Object.<string, boolean>

    The browser extension components that will be managed by this plugin.

    Valid components are:

    • background
    • popup
    • options
    • contentScripts
    • override
    • standalone
    • devtools
    components: {
      background: true,
      contentScripts: true
    }
    
  • componentOptions

    • Type: Object.<string, Object>

    See Component options.

  • extensionReloaderOptions

    • Type: Object.<string, Object>

    See available options in webpack-extension-reloader.

  • manifestSync

    • Type: Array<string>
    • Default: ['version']

    Array containing names of manifest.json keys that will be automatically synced with package.json on build.

    Currently, the only supported keys are version and description.

  • manifestTransformer

    • Type: Function

    Function to modify the manifest JSON outputted by this plugin.

    An example use case is adding or removing permissions depending on which browser is being targeted.

    manifestTransformer: (manifest) => {
      if (process.env.BROWSER === 'chrome') {
        manifest.permissions.push('pageCapture');
      }
      return manifest;
    };
    
  • modesToZip

    Deprecated. Any mode will be zipped to the artifacts dir, when NODE_ENV=production (the default in the normal yarn build). For more information on how to set NODE_ENV=production in other modes see Vue CLI docs โ€“ Example Staging Mode

  • artifactsDir

    • Type: string
    • Default: './artifacts'

    Directory where the zipped browser extension should get created.

Component options

Some browser extension components have additional options which can be set as follows:

// vue.config.js
module.exports = {
  pluginOptions: {
    browserExtension: {
      componentOptions: {
        // <name of component>: <options>
        // e.g.
        contentScripts: {
          entries: {
            content1: 'src/content-script1.js',
            content2: 'src/content-script2.js',
          },
        },
      },
    },
  },
};

background

  • entry

    • Type: string|Array<string>

    Background script as webpack entry using the single entry shorthand syntax.

    background: {
      entry: 'src/my-background-script.js';
    }
    

contentScripts

  • entries

    • Type: {[entryChunkName: string]: string|Array<string>}

    Content scripts as webpack entries using using the object syntax.

    contentScripts: {
      entries: {
        'my-first-content-script': 'src/content-script.js',
        'my-second-content-script': 'src/my-second-script.js'
      }
    }
    

Internationalization

Some boilerplate for internationalization has been added. This follows the i18n (chrome|WebExtention) spec. Provided for you is the default_locale option in the manifest, and a _locales directory. There is some basic usage of it in the manifest, as well as in some of the boilerplate files. Since this is largely an out of the box solution provided by the browsers, it is heavily encouraged to utilize it. If you do not want to translate your app, simply delete the public/_locales directory, and no longer use the browser.i18n methods.

Browser Polyfills

This plugin by default adds in the official mozilla webextension polyfill to the build. The opinion of this plugin is that developers should be building cross platform, and should have reasonable tooling to do so. By emphasizing cross platform first, your application will be adhering to the community standards, be ready for distribution to other extension stores, and avoid developing against browser APIs that may have no equivalent. The polyfill is a no-op on firefox, and only takes up 20.5kb unminified.

If you still feel strongly to not include the polyfill, then this is what you need to add to your webpack chain to do so.

vue.config.js

module.exports = {
  chainWebpack(config) {
    config.plugins.delete('provide-webextension-polyfill');
    config.module.rules.delete('provide-webextension-polyfill');
  },
};

Testing

This library is following the standard styling of vue projects, and those are really the only tests to perform.

yarn test

Roadmap

  • A preset
  • Cleanup the dist-zip directory

Credits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].