Skip to content

Commit

Permalink
Release v0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Nov 19, 2022
1 parent f8cda61 commit e7061e5
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ See the **TypeScript Declarations** at the top of [img-src-placeholder.ts](img-s
## D) Under the Hood
The data URL is created by **Base64** encoding a super simple `<svg>` string:
```javascript
const onePixelSvg = '<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"></svg>';
const dataImage = 'data:image/svg+xml;base64,' + Buffer.from(onePixelSvg).toString('base64');
const onePixelSvg =
'<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"></svg>';
const dataImage = 'data:image/svg+xml;base64,' +
Buffer.from(onePixelSvg).toString('base64');
```

<br>
Expand Down
6 changes: 3 additions & 3 deletions dist/img-src-placeholder.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
//! img-src-placeholder v0.1.0 ~~ https://github.com/center-key/img-src-placeholder ~~ MIT License
//! img-src-placeholder v0.1.1 ~~ https://github.com/center-key/img-src-placeholder ~~ MIT License

import { Results } from 'replacer-util';
export declare type Settings = {
export type Settings = {
cd: string | null;
extensions: string[];
filename: string | null;
};
export declare type Options = Partial<Settings>;
export type Options = Partial<Settings>;
declare const imgSrcPlaceholder: {
htmlExts: string[];
transform(sourceFolder: string, targetFolder: string, options?: Options): Results;
Expand Down
2 changes: 1 addition & 1 deletion dist/img-src-placeholder.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! img-src-placeholder v0.1.0 ~~ https://github.com/center-key/img-src-placeholder ~~ MIT License
//! img-src-placeholder v0.1.1 ~~ https://github.com/center-key/img-src-placeholder ~~ MIT License

import { replacer } from 'replacer-util';
const imgSrcPlaceholder = {
Expand Down
2 changes: 1 addition & 1 deletion dist/img-src-placeholder.umd.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! img-src-placeholder v0.1.0 ~~ https://github.com/center-key/img-src-placeholder ~~ MIT License
//! img-src-placeholder v0.1.1 ~~ https://github.com/center-key/img-src-placeholder ~~ MIT License

(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "img-src-placeholder",
"version": "0.1.0",
"version": "0.1.1",
"description": "Replace src=# in <img> tags of HTML files with an inline data URL of a transparent 1 pixel image (CLI tool designed for use in npm scripts)",
"license": "MIT",
"type": "module",
Expand Down
10 changes: 5 additions & 5 deletions spec/mocha.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import fs from 'fs';
// Setup
import { imgSrcPlaceholder } from '../dist/img-src-placeholder.js';

////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
describe('The "dist" folder', () => {

it('contains the correct files', () => {
Expand All @@ -26,7 +26,7 @@ describe('The "dist" folder', () => {

});

////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
describe('Library module', () => {

it('is an object', () => {
Expand All @@ -43,7 +43,7 @@ describe('Library module', () => {

});

////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
describe('Calling imgSrcPlaceholder.transform()', () => {

it('creates the correct text files in the target folder', () => {
Expand All @@ -59,7 +59,7 @@ describe('Calling imgSrcPlaceholder.transform()', () => {

});

////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
describe('Correct error is thrown', () => {

it('when the "source" folder is missing', () => {
Expand All @@ -76,7 +76,7 @@ describe('Correct error is thrown', () => {

});

////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
describe('Executing the CLI', () => {

it('creates the expected file with the correct <img> placeholder', () => {
Expand Down

0 comments on commit e7061e5

Please sign in to comment.