1.1.3 • Published 1 year ago

html-pages-preview v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

HTML Pages Preview

Merged one HTML page from defined list of the pages/templates for preview

License:MIT npm

Why

Generated preview for all pages on the one for test or demonstration purposes

How to install

npm

npm i html-pages-preview --save-dev

yarn

yarn html-pages-preview -D

How to use

const htmlPreview = require('./lib/merged-html-preview');

const src = [
  './dist/article.html',
  './dist/home.html',
  './dist/product.html'
];

const dest = './dist/preview.html';

htmlPreview(src, dest)

Gulp integration

import gulp from 'gulp';
const { parallel, watch } = gulp;

import htmlPreview from 'html-pages-preview';

const htmlPagesPreview = (c) => {
  const src = [
    './dist/home.html',
    './dist/article.html',
    './dist/product.html'
  ];

  const dest = './dist/preview.html';

  htmlPreview(src, dest);
  return c();
};

const watcher = () => {
  watch('./dist/*.html', htmlPagesPreview);
};

export default
  parallel(
    htmlPagesPreview,
    watcher
  )

Config parameters

Default values

cfg = {
  styles: '',
  header: 'Pages Preview',
  toc: true,
  newtab: true,
  toggle: true,
  animation: true,
  pane: true,
  title: true,
  titleDivider: '-',
  filename: true,
  baseUrl: '',
  backToIndex: true,
  backToIndexUrl: ''
}

htmlPreview(src, dest, cfg);
ValueDefaultDescription
styles''custom CSS for header, panel etc. Initial styles based on bootstrap 5
header'Pages Preview'page header
toctrueshow/hide Table of the content
newtabtrueshow/hide new tab link
toggletrueshow/hide toggle link
panetrueshow/hide panel with links and iframe title
titletrueshow/hide panel title
titleDivider-Divide filename and page tytle by symbol
filenametrueshow/hide filename at the panel title
baseUrl./Base URL for pages (Default is destination folder)
backToIndextrueshow/hide back link
backToIndexUrl''When empty default link is './index.html'

Related Projects

I created this and some additional services for html-base to improve quality of frontend output. Here is the list:

Contributing

For issues, bugs or imporvements please open an issue


MIT License