diff --git a/.codebeatsettings b/.codebeatsettings new file mode 100644 index 0000000..cd81b13 --- /dev/null +++ b/.codebeatsettings @@ -0,0 +1,28 @@ +{ + "TYPESCRIPT": { + "ABC": [ + 20, + 40, + 80, + 120 + ], + "LOC": [ + 50, + 80, + 120, + 160 + ], + "TOTAL_LOC": [ + 400, + 500, + 640, + 900 + ], + "BLOCK_NESTING": [ + 6, + 8, + 10, + 12 + ] + } +} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ad18ca2..6b40cb7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - node-version: [14.x, 16.x] + node-version: [18.x] steps: - uses: actions/checkout@v3 diff --git a/.npmignore b/.npmignore index 5b49455..f5c3cfb 100644 --- a/.npmignore +++ b/.npmignore @@ -21,6 +21,7 @@ Thumbs.db .github _config.yml _.config.yml +.codebeatsettings .editorconfig .gitattributes .gitignore diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..b009dfb --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +lts/* diff --git a/README.md b/README.md index 5df4338..93db3ac 100644 --- a/README.md +++ b/README.md @@ -55,9 +55,11 @@ or unclude it from unpkg.com ## Usage -### In a browser: +### In a browser ```javascript +import svg64 from 'svg64'; // or use window.svg64.default + // This is your SVG DOM element const svg = document.getElementById('svg'); @@ -65,13 +67,13 @@ const svg = document.getElementById('svg'); const demo = document.getElementById('demo'); // This is your SVG in base64 representation -const base64fromSVG = window.svg64(svg); +const base64fromSVG = svg64(svg); // Add the base64 image as a background to your element demo.style.backgroundImage = `url(${base64fromSVG})`; ``` -### In Node: +### In Node ```javascript // Require svg64 diff --git a/demo/index.html b/demo/index.html index 310f85b..1308620 100644 --- a/demo/index.html +++ b/demo/index.html @@ -146,8 +146,10 @@

Usage in browser

+import svg64 from 'svg64'; // or use window.svg64.default
+
 const svg = document.getElementById('svg');
-const b64 = window.svg64(svg);
+const b64 = svg64(svg);
 const demo = document.getElementById('demo');
 
 demo.style.backgroundImage = `url(${b64})`;
@@ -212,11 +214,11 @@ 

This is the base64 encoded SVG used as a backgrou - +