Coder Social home page Coder Social logo

kocal / vue-web-extension Goto Github PK

View Code? Open in Web Editor NEW
1.6K 1.6K 166.0 1.21 MB

🛠️ A Vue CLI 3+ preset (previously a Vue CLI 2 boilerplate) for quickly starting a web extension with Vue, Babel, ESLint and more!

Home Page: https://vue-web-extension.netlify.app/

License: MIT License

JavaScript 100.00%
babel eslint prettier vue vue-router vuex web-extension webpack

vue-web-extension's Introduction

vue-web-extension

Netlify Status

⚠️ This README is for the master version of the preset. If you use the v1 of this boilerplate with Vue-CLI 2 support, please see v1 branch.


This Vue CLI preset allows you to quickly start a web extension containing:

Requirements

Documentation

The documentation can be found on vue-web-extension.netlify.app. Please check the documentation website and the open and closed issues, before raising a new issue.

Usage

$ vue create --preset kocal/vue-web-extension my-extension
$ cd my-extension
$ npm run build

npm run build

Build the extension into dist folder for production.

A zip file is also built and is located in artifacts directory.

npm run serve

Build the extension for development and watch over file changes.

It also automatically reload your extension into your browsers, thanks to webpack-extension-reloader plugin.

Options

See https://github.com/adambullmer/vue-cli-plugin-browser-extension#plugin-options

vue-web-extension's People

Contributors

andriyor avatar dependabot-preview[bot] avatar dependabot[bot] avatar goddywu avatar haojen avatar iliyazelenko avatar kocal avatar spekulatius avatar svenluijten avatar veligura avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-web-extension's Issues

Setup Parcel

And let the user choose between Webpack or Parcel, during installation

fix(tests): handle errors from `tests/*` scripts properly

See https://travis-ci.org/Kocal/vue-web-extension/jobs/375313036.

To resume, this behavor [[ A ]] && B || C:

  • eval A
  • If A is truthy, it eval B
  • If A is falsy, it eval C
  • If B exit incorrectly, it also eval C... so Travis build is green.

Changing this behavior by [[ A ]] && C || B || exit $? will:

  • eval A
  • If A is truthy, it eval C
  • C will never fails (it's a simple echo)
  • If A is falsy, it eval B
  • If B is truthy, it's fine
  • If B is falsy, it exit with last status code, so Travis build is red 😄

Dependabot couldn't find a package.json for this project

Dependabot couldn't find a package.json for this project.

Dependabot requires a package.json to evaluate your project's current JavaScript dependencies. It had expected to find one at the path: /example/package.json.

If this isn't a JavaScript project, or if it is a library, you may wish to disable updates for it from within Dependabot.

You can mention @dependabot in the comments below to contact the Dependabot team.

Need help to put content script right way

Hi I try to use content script, but it's seem to be not working.

What I do is:

Create new content.js

chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
  // If the received message has the expected format...
  console.log('rn')
  if (msg.text === 'report_back') {
    // Call the specified callback, passing
    // the web-page's DOM content as argument
    sendResponse('Hello');
  }
});

add it to manifest

{
  "name": "movie-extension",
  "description": "A Vue.js web extension",
  "version": "1.0.0",
  "manifest_version": 2,
  "icons": {
    "48": "icons/icon_48.png",
    "128": "icons/icon_128.png"
  },
  "permissions": [
    "activeTab"
  ],
  "browser_action": {
    "default_title": "movie-extension",
    "default_popup": "popup/popup.html"
  },
  "content_scripts": [{
    "matches": ["*://*.google.com/*"],
    "js": ["content.js"]
  }],
  "background": {
    "scripts": [
      "background.js"
    ]
  }
}

add file to the CopyWebpackPlugin

new CopyWebpackPlugin([
      {from: 'icons', to: 'icons', ignore: ['icon.xcf']},
      {from: 'popup/popup.html', to: 'popup/popup.html'},
      {from: 'manifest.json', to: 'manifest.json'},
      {from: 'content.js', to: 'content.js'}
    ])

Try to use it in the vue component

<template>
  <div>
    <p>Hello world!</p>
    <button @click="test">Test</button>
  </div>
</template>

<script>
  export default {
    data () {
      return { }
    },
    methods: {
      test () {
        chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
          chrome.tabs.sendMessage(tabs[0].id, {text: 'report_back'}, function(response) {
            console.log(response);
          });
        });
      }
    }
  }
</script>

But I got undefined in the console.log :(

Development workflow

Is your feature request related to a problem? Please describe.
No.

Additional context
This repository is great and helpful, Thank You!

There is no documentation and i can't seem to find too much resources in the issues section here. I was wondering what's the normal development workflow is? If i build this once and then drag this to Chrome it installs it, once a change is made we need to build it again and drag it again?

I am just wondering what the process is.

Thank You.

Add newtab scenario

I'm trying to build an extension that will also incorporate a new tab,
Besides all the great features in this library, I could not find a solution for that. (I'm quite a starter on Vue so I had some hard time to get it running myself)

Is that something on the roadmap?

Vue Devtools?

Any way to use Vue Devtools in a page from the extension?

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.