Skip to content

Commit

Permalink
Docs: Introduce example for CommonJS require
Browse files Browse the repository at this point in the history
  • Loading branch information
literat committed Dec 6, 2021
1 parent 9e3876d commit 8a30904
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 821 deletions.
1 change: 1 addition & 0 deletions examples/module/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bundle.js
yarn.lock
2 changes: 1 addition & 1 deletion examples/module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"webpack-cli": "^4.9.1"
},
"dependencies": {
"@lmc-eu/cookie-consent-manager": "^0.4.1"
"@lmc-eu/cookie-consent-manager": "../../dist"
},
"scripts": {
"build": "webpack build --config ./webpack.config.js"
Expand Down
819 changes: 0 additions & 819 deletions examples/module/yarn.lock

This file was deleted.

2 changes: 2 additions & 0 deletions examples/node/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bundle.js
yarn.lock
20 changes: 20 additions & 0 deletions examples/node/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>

<title>Cookie Consent Manager – module example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap">

<link rel="stylesheet" href="../../dist/LmcCookieConsentManager.min.css"><!-- You will load this from CDN instead -->

</head>
<body>
<h1>LMC Cookie Consent Manager</h1>
<script defer src="./bundle.js"></script>
</body>
</html>
6 changes: 6 additions & 0 deletions examples/node/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// eslint-disable-next-line import/no-unresolved
const LmcCookieConsentManager = require('@lmc-eu/cookie-consent-manager');

window.addEventListener('load', () => {
LmcCookieConsentManager('example');
});
15 changes: 15 additions & 0 deletions examples/node/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@lmc-eu/cookie-consent-manager-example-node",
"version": "1.0.0",
"license": "MIT",
"devDependencies": {
"webpack": "^5.63.0",
"webpack-cli": "^4.9.1"
},
"dependencies": {
"@lmc-eu/cookie-consent-manager": "../../dist"
},
"scripts": {
"build": "webpack build --config ./webpack.config.js"
}
}
10 changes: 10 additions & 0 deletions examples/node/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const path = require('path');

module.exports = {
resolve: { mainFields: ["main", "module"] },
entry: './index.js',
output: {
path: path.resolve(__dirname, './'),
filename: 'bundle.js',
},
};
1 change: 0 additions & 1 deletion examples/webpack-with-cjs/bundle.js

This file was deleted.

0 comments on commit 8a30904

Please sign in to comment.