diff --git a/.gitignore b/.gitignore index aa1dad1..a42179d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ node_modules/ -dist/bundle.js +dist/caracals-badge.js package-lock.json diff --git a/README.md b/README.md index 0e6c301..a5cb6d7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ +Inspired by: [github-fork-ribbon-css](https://github.com/simonwhitaker/github-fork-ribbon-css) +Using [Webpack](https://webpack.js.org/) + + Install ======= @@ -9,14 +13,16 @@ Install Build ===== - npm run dev + npm run prod The JS bundle is then located in `dist/` folder. -Dev -=== -AJouter un nouveau paquet pour la compilation : +Usage +===== +Just add (orientation can be `left-bottom`, `right-bottom`, `right-top` or `left-top`): - npm install --save-dev XXX +```html + +``` diff --git a/dist/index.html b/dist/index.html index 91af06f..9bb485b 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,6 +1,21 @@
- + + + + +
+
+<script src="caracals-badge.js" orientation="right-bottom">
+
+
diff --git a/main-badge.js b/main-badge.js
new file mode 100644
index 0000000..ef72d7c
--- /dev/null
+++ b/main-badge.js
@@ -0,0 +1,8 @@
+require('./style.css');
+
+var orientation = document.currentScript.getAttribute('orientation');
+
+document.write("");
diff --git a/main.js b/main.js
deleted file mode 100644
index 51dbf42..0000000
--- a/main.js
+++ /dev/null
@@ -1,3 +0,0 @@
-require('./style.css');
-
-document.write("");
diff --git a/package.json b/package.json
index 6d2cf24..7d47ee7 100644
--- a/package.json
+++ b/package.json
@@ -1,8 +1,7 @@
{
- "name": "js-include",
+ "name": "caracals-badge",
"version": "1.0.0",
"description": "",
- "main": "./bundle.js",
"scripts": {
"dev": "webpack --mode development",
"prod": "webpack --mode production"
diff --git a/webpack.config.js b/webpack.config.js
index 328a90c..f3df4e5 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,7 +1,7 @@
module.exports = {
- entry: './main.js',
+ entry: './main-badge.js',
output: {
- filename: './bundle.js'
+ filename: './caracals-badge.js'
},
module: {
rules:[