|
1 | 1 | # vue-cli-plugin-browser-extension |
2 | | -Browser extension development plugin for vue-cli 3.0 |
| 2 | +Browser extension development plugin for vue-cli 3.x |
| 3 | + |
| 4 | +## What does it do? |
| 5 | +This is intended to be a [email protected] replacement for [https://github.com/Kocal/vue-web-extension](https://github.com/Kocal/vue-web-extension). |
| 6 | +This plugin adds a new command `ext-serve` to your vue applications. |
| 7 | +This new command is only for running a livereload server while testing out your browser extension. |
| 8 | +This removes the entrypoint of `main.js`, and as such will not scaffold a general vue app. |
| 9 | +That behavior might change when support for a standalone tab application exists, but for now it is gone. |
| 10 | +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. |
| 11 | +It makes some assumptions about your project setup. |
| 12 | +I hope to be able to scaffold an app so that itentifying the below in unnecessary. |
| 13 | + |
| 14 | +``` |
| 15 | +|- src/ |
| 16 | + |- assets/ |
| 17 | + |- Static assets in use in your app, like logo.png |
| 18 | + |- icons/ |
| 19 | + |- Icons for your extension. Should include a 16, 19, 38, 48, 128 px square image |
| 20 | + |- popup/ |
| 21 | + |- router/ |
| 22 | + |- pages/ |
| 23 | + |- Index.vue |
| 24 | + |- index.js |
| 25 | + |- routes.js |
| 26 | + |- App.vue |
| 27 | + |- popup.html |
| 28 | + |- popup.js |
| 29 | + |- store/ |
| 30 | + |- actions.js |
| 31 | + |- getters.js |
| 32 | + |- index.js |
| 33 | + |- mutation-types.js |
| 34 | + |- mutations.js |
| 35 | + |- background.js |
| 36 | + |- manifest.json |
| 37 | +``` |
| 38 | + |
| 39 | +## Usage |
| 40 | +Running the Livereload server. |
| 41 | +This will build and write to the local `dist` directory. |
| 42 | +You can then add this as an unpacked plugin to your browser, and will continue to update as you make changes. |
| 43 | +**NOTE:** you cannot get HMR support in the popup window, however, closing and reopening will refresh your content. |
| 44 | + |
| 45 | +```sh |
| 46 | +yarn ext-serve |
| 47 | +``` |
| 48 | + |
| 49 | + |
| 50 | +## Testing |
| 51 | +This library is following the standard styling of vue projects, and those are really the only tests to perform. |
| 52 | + |
| 53 | +```sh |
| 54 | +yarn test |
| 55 | +``` |
| 56 | + |
| 57 | +## Roadmap |
| 58 | +- Add generators for background.js, popup, vuex, and vue-router stuff. (Make startup a breeze) |
| 59 | +- Add some generator options for other pieces of browser extensions. This includes scaffolding the components/dirs, and registering the build options into the build time hooks. |
| 60 | + - Dev Tools |
| 61 | + - Dedicated extension pages |
| 62 | + - Options Pages |
| 63 | + - Content scripts |
| 64 | +- Add zipping to the bundle for production builds |
| 65 | +- More configurability in scaffolding, like Kocal/vue-web-extension does |
| 66 | +- A preset |
| 67 | + |
| 68 | +## Credits |
| 69 | +- [https://github.com/Kocal/vue-web-extension](https://github.com/Kocal/vue-web-extension) For inspiration on app and build structure |
| 70 | +- [https://github.com/YuraDev/vue-chrome-extension-template](https://github.com/YuraDev/vue-chrome-extension-template) For the logo crop and app/scaffold structure |
| 71 | +- [@YuraDev](https://github.com/YuraDev) for the wonderful WCER plugin for livereloading extensions |
0 commit comments