Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add devtools support #27

Merged
merged 1 commit into from
Feb 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
.env.development.local
.env.test.local
.env.production.local
.history

# secrets
secrets.*.js
13 changes: 8 additions & 5 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@
"icons": {
"128": "icon-128.png"
},
"content_scripts": [{
"matches": ["http://*/*", "https://*/*", "<all_urls>"],
"js": ["contentScript.bundle.js"],
"css": ["content.styles.css"]
}],
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*", "<all_urls>"],
"js": ["contentScript.bundle.js"],
"css": ["content.styles.css"]
}
],
"devtools_page": "devtools.html",
"web_accessible_resources": [
"content.styles.css",
"icon-128.png",
Expand Down
9 changes: 9 additions & 0 deletions src/pages/Devtools/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title></title>
</head>

<body></body>
</html>
1 change: 1 addition & 0 deletions src/pages/Devtools/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chrome.devtools.panels.create('Dev Tools', 'icon-34.png', 'panel.html');
7 changes: 7 additions & 0 deletions src/pages/Panel/Panel.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
body {
background-color: #242424;
}

.container {
color: #ffffff;
}
13 changes: 13 additions & 0 deletions src/pages/Panel/Panel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';

import './Panel.css';

const Panel = (): JSX.Element => {
return (
<div className="container">
<h1>Dev Tools Panel</h1>
</div>
);
};

export default Panel;
Empty file added src/pages/Panel/index.css
Empty file.
11 changes: 11 additions & 0 deletions src/pages/Panel/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Panel</title>
</head>

<body>
<div id="app-container"></div>
</body>
</html>
7 changes: 7 additions & 0 deletions src/pages/Panel/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';
import { render } from 'react-dom';

import Panel from './Panel';
import './index.css';

render(<Panel />, window.document.querySelector('#app-container'));
16 changes: 15 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ var options = {
popup: path.join(__dirname, 'src', 'pages', 'Popup', 'index.jsx'),
background: path.join(__dirname, 'src', 'pages', 'Background', 'index.js'),
contentScript: path.join(__dirname, 'src', 'pages', 'Content', 'index.js'),
devtools: path.join(__dirname, 'src', 'pages', 'Devtools', 'index.js'),
panel: path.join(__dirname, 'src', 'pages', 'Panel', 'index.tsx'),
},
chromeExtensionBoilerplate: {
notHotReload: ['contentScript'],
notHotReload: ['contentScript', 'devtools'],
},
output: {
path: path.resolve(__dirname, 'build'),
Expand Down Expand Up @@ -172,6 +174,18 @@ var options = {
chunks: ['background'],
cache: false,
}),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'src', 'pages', 'Devtools', 'index.html'),
filename: 'devtools.html',
chunks: ['devtools'],
cache: false,
}),
new HtmlWebpackPlugin({
template: path.join(__dirname, 'src', 'pages', 'Panel', 'index.html'),
filename: 'panel.html',
chunks: ['panel'],
cache: false,
}),
],
infrastructureLogging: {
level: 'info',
Expand Down