Skip to content

Instantly share code, notes, and snippets.

@ganeshjaiwal
ganeshjaiwal / action.yml
Created October 2, 2020 07:58
This is an exaple of github action workflow
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
@ganeshjaiwal
ganeshjaiwal / package.json
Created October 2, 2020 07:12
package.json file with required dependencies to automate publishing extension process.
{
"name": "chrome-extension-demo",
"version": "1.0.0",
"description": "This is a demo extension",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"deploy": "node deploy.js"
},
"repository": {
@ganeshjaiwal
ganeshjaiwal / manifest.json
Created September 3, 2020 07:43
Options page in manifest file
/*
Specifying options page entry to manifest will allow you to use options in your extension.
*/
"options_page": "pages/options/options.html",
"options_ui": {
"page": "pages/options/options.html",
"chrome_style": true
}
@ganeshjaiwal
ganeshjaiwal / manifest.json
Created September 3, 2020 07:41
Content script section in manifest fine
/*
Add this to manifest file to inject contentscript.js into web page.
*/
"content_scripts": [
{
"matches": [
"http://*/*",
"https://*/*"
],
"css": [
@ganeshjaiwal
ganeshjaiwal / manifest.json
Created September 3, 2020 07:39
Browser action section in manifest file
/*
Add this to manifest file so user can see popup on browser action click.
*/
"browser_action": {
"default_icon": {
"19": "images/icon-19.png",
"38": "images/icon-38.png"
},
"default_title": "My First Extension",
"default_popup": "pages/popup/popup.html"
@ganeshjaiwal
ganeshjaiwal / background.js
Created September 3, 2020 07:37
Background page
/* Create background.js and add this code into it */
chrome.runtime.onInstalled.addListener((details) => {
 console.log('previousVersion', details.previousVersion)
});
console.log('Event Page for Page Action');
@ganeshjaiwal
ganeshjaiwal / background.js
Last active September 3, 2020 08:26
Background section in manifest with background script
/* Create background.js and add this code into it */
chrome.runtime.onInstalled.addListener((details) => {
console.log('previousVersion', details.previousVersion)
});
console.log('Event Page for Page Action');
@ganeshjaiwal
ganeshjaiwal / manifest.json
Last active September 3, 2020 07:28
Manifest file structure
{
"name": "My First Extension",
"short_name": "First App",
"description": "App for demo.",
"version": "1.0.0",
"manifest_version": 2,
"icons": {
"16": "images/icon-16.png",
"128": "images/icon-128.png"
}