{"id":17445976,"url":"https://github.com/jamen/pull-create-html","last_synced_at":"2025-07-30T12:10:34.388Z","repository":{"id":65478630,"uuid":"90842799","full_name":"jamen/pull-create-html","owner":"jamen","description":"Create an HTML file from JS and CSS file streams","archived":false,"fork":false,"pushed_at":"2017-08-26T07:29:08.000Z","size":31,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-11T22:20:50.178Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamen.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-10T08:54:37.000Z","updated_at":"2021-12-19T15:35:49.000Z","dependencies_parsed_at":"2023-01-25T07:55:12.881Z","dependency_job_id":null,"html_url":"https://github.com/jamen/pull-create-html","commit_stats":null,"previous_names":["jamen/pull-bundle-html"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpull-create-html","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpull-create-html/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpull-create-html/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamen%2Fpull-create-html/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamen","download_url":"https://codeload.github.com/jamen/pull-create-html/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234143351,"owners_count":18786140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-17T18:19:25.645Z","updated_at":"2025-01-16T03:15:27.254Z","avatar_url":"https://github.com/jamen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# pull-create-html\n\n\u003e Create an html file from js and css file streams\n\nA stream that produces a [html pull-stream file](https://github.com/jamen/pull-files) with optional settings such as a title, various meta options, js and css content streams, and a body, etc.\n\n```js\nvar pull = require('pull-stream')\nvar { read, write } = require('pull-files')\nvar bundle = require('pull-bundle-js')\nvar html = require('pull-create-html')\n\nvar js = pull(\n  read(__dirname + '/lib/index.js'),\n  bundle([ ...transforms ])\n)\n\nvar css = pull(\n  read(__dirname + '/style/**/*.sass'),\n  sass()\n)\n\n// Create html from meta options + the js and css file streams\npull(\n  html('foo.html', {\n    // Meta options\n    title: 'foo',\n    body: '\u003cdiv clas=\"app\"\u003e\u003c/div\u003e',\n    meta: [\n      { name: 'description', content: 'Example' },\n      { name: 'viewport', content: 'width=device-width, initial-scale=1, user-scalable=0' }\n    ]\n    // File streams\n    js,\n    css \n  }),\n  write(__dirname + '/out', err =\u003e {\n    // Finished\n  })\n)\n```\n\n## Install\n\n```sh\nnpm i pull-create-html\n```\n\n## Usage\n\n### `html(path?, options)`\n\nCreates an html file from js and css file streams, with several options configure the boilerplate html.\n\n - `js` a stream of js files which put in `\u003cscript\u003e`\n - `css` a stream of css files which get put in `\u003cstyle\u003e`\n - `lang` sets the `\u003chtml lang=...\u003e` attribute.  Defaults to `en-US`\n - `title` sets the `\u003ctitle\u003e...\u003c/title\u003e` element\n - `body` is a string of HTML to put before where the JS is injected.  e.g. a mount element for vdom\n - `charset` sets the `\u003cmeta charset=...\u003e` element.  Defaults to `utf-8`\n - `base` sets the `file.base` on the output HTML file\n - `scriptAsync` lets the JS files load async by setting `\u003cscript async=\"true\"\u003e` in the `\u003chead\u003e`\n - `links` Lets you specify `\u003clink\u003e` as a list of objects\n - `meta` Lets you specify `\u003cmeta\u003e` as a list of objects\n\nFiles in the js/css stream are [concatenated together](https://github.com/jamen/pull-concat-files).  Allows streaming a directory of plain css files, for example.\n\n```js\npull(\n  html('app.html', {\n    title: 'Example site',\n     \n    js: pull(\n      read(__dirname + '/lib/index.js'),\n      bundle([ ...transforms ])\n    ),\n\n    css: pull(\n      read(__dirname + '/style/index.sass'),\n      sass()\n    )\n  }),\n  write(__dirname + '/out', err =\u003e {\n    // Finished\n  })\n)\n```\n\nFor using `options.links`, you specify a list of objects:\n\n```js\nlinks: [\n  { href: 'foo.css', type: 'text/css', rel: 'stylesheet' }\n  // ...\n]\n```\n\nLikewise with `options.meta`:\n\n```js\nmeta: [\n  { name: 'description', content: 'Foo bar baz!' },\n  { name: 'keywords', content: 'example, test, foo, bar' },\n  // ...\n]\n```\n\n# Also see\n\n - [`pull-files`](https://github.com/jamen/pull-files)\n - [`pull-bundle-js`](https://github.com/jamen/pull-bundle-js)\n - [`pull-minify-js`](https://github.com/jamen/pull-minify-js)\n - [`pull-concat-files`](https://github.com/jamen/pull-concat-files)\n - [`pull-minify-css`](https://github.com/jamen/pull-minify-css)\n\n---\n\nMaintained by [Jamen Marz](https://git.io/jamen) (See on [Twitter](https://twitter.com/jamenmarz) and [GitHub](https://github.com/jamen) for questions \u0026 updates)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fpull-create-html","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamen%2Fpull-create-html","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamen%2Fpull-create-html/lists"}