Vue.js is a progressive JavaScript framework for building user interfaces. It is designed to be incrementally adoptable, with a core library that focuses on the view layer only.
Extension.js offers built-in support for Vue.js and its single-file component system. To use Vue.js in your extension, make sure you have Vue added as a dependency
or devDependency
in your package.json
. Once added, you are ready to start building your extension with Vue.js!
Extension.js includes a New Tab Vue.js template, ideal for creating new tab pages using Vue. This template provides everything you need to get started with Vue.js in your extension.
Alternatively, Extension.js supports a Content Script Vue.js template, enabling you to inject Vue components into web pages via content scripts. This template is useful for extensions that interact directly with page content.
To integrate Vue.js into an existing extension, follow these steps:
Install the required dependencies:
Extension.js expects Vue components to be in the .vue
format, using Vue’s single-file components (SFC). These files contain the HTML, JavaScript, and CSS for a component all in one file, which is compiled during the build process.
To use Vue.js in a new tab extension, include it in your HTML file as a <script>
:
content_script
FileFor content scripts, you can inject Vue.js into the page by dynamically creating an HTML element and mounting a Vue component into it: