-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
一个简单的chrome插件
- Loading branch information
Showing
19 changed files
with
4,426 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# dependencies | ||
/node_modules | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
|
||
npm-debug.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# <img src="public/icons/icon_48.png" width="45" align="left"> Chrome Plugin Starter | ||
|
||
My Chrome Extension | ||
|
||
## Features | ||
|
||
- Feature 1 | ||
- Feature 2 | ||
|
||
## Install | ||
|
||
[**Chrome** extension]() | ||
|
||
## Contribution | ||
|
||
Suggestions and pull requests are welcomed!. | ||
|
||
--- | ||
|
||
This project was bootstrapped with [Chrome Extension CLI](https://github.com/dutiyesh/chrome-extension-cli) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
|
||
const PATHS = { | ||
src: path.resolve(__dirname, '../src'), | ||
build: path.resolve(__dirname, '../build'), | ||
}; | ||
|
||
module.exports = PATHS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
'use strict'; | ||
|
||
const SizePlugin = require('size-plugin'); | ||
const CopyWebpackPlugin = require('copy-webpack-plugin'); | ||
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | ||
|
||
const PATHS = require('./paths'); | ||
|
||
// To re-use webpack configuration across templates, | ||
// CLI maintains a common webpack configuration file - `webpack.common.js`. | ||
// Whenever user creates an extension, CLI adds `webpack.common.js` file | ||
// in template's `config` folder | ||
const common = { | ||
output: { | ||
// the build folder to output bundles and assets in. | ||
path: PATHS.build, | ||
// the filename template for entry chunks | ||
filename: '[name].js', | ||
}, | ||
devtool: 'source-map', | ||
stats: { | ||
all: false, | ||
errors: true, | ||
builtAt: true, | ||
}, | ||
module: { | ||
rules: [ | ||
// Help webpack in understanding CSS files imported in .js files | ||
{ | ||
test: /\.css$/, | ||
use: [MiniCssExtractPlugin.loader, 'css-loader'], | ||
}, | ||
// Check for images imported in .js files and | ||
{ | ||
test: /\.(png|jpe?g|gif)$/i, | ||
use: [ | ||
{ | ||
loader: 'file-loader', | ||
options: { | ||
outputPath: 'images', | ||
name: '[name].[ext]', | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
// Print file sizes | ||
new SizePlugin(), | ||
// Copy static assets from `public` folder to `build` folder | ||
new CopyWebpackPlugin({ | ||
patterns: [ | ||
{ | ||
from: '**/*', | ||
context: 'public', | ||
}, | ||
] | ||
}), | ||
// Extract CSS into separate files | ||
new MiniCssExtractPlugin({ | ||
filename: '[name].css', | ||
}), | ||
], | ||
}; | ||
|
||
module.exports = common; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
const { merge } = require('webpack-merge'); | ||
|
||
const common = require('./webpack.common.js'); | ||
const PATHS = require('./paths'); | ||
|
||
// Merge webpack configuration files | ||
const config = merge(common, { | ||
entry: { | ||
popup: PATHS.src + '/popup.js', | ||
contentScript: PATHS.src + '/contentScript.js', | ||
background: PATHS.src + '/background.js', | ||
}, | ||
}); | ||
|
||
module.exports = config; |
Oops, something went wrong.