{"_id":"posthtml-inline-assets","_rev":"9-360570d7897b9b06ace0417e127f805f","name":"posthtml-inline-assets","description":"Inline external scripts, styles, and images in HTML","dist-tags":{"latest":"3.1.0"},"versions":{"1.0.0":{"name":"posthtml-inline-assets","version":"1.0.0","description":"Inline external scripts, styles, and images in HTML","keywords":["posthtml","html","posthtml-plugin","inline","assets","javascripts","images","styles","js","img","css"],"author":{"name":"Jonathan Neal","email":"jonathantneal@hotmail.com"},"license":"CC0-1.0","repository":{"type":"git","url":"git+https://github.com/jonathantneal/posthtml-inline-assets.git"},"homepage":"https://github.com/jonathantneal/posthtml-inline-assets","bugs":{"url":"https://github.com/jonathantneal/posthtml-inline-assets/issues"},"dependencies":{"file-type":"^3.3.1","fs-extra":"^0.26.2","fs-promise":"^0.3.1","posthtml":"^0.8.0"},"devDependencies":{"eslint":"^1.10.3","tap-spec":"^4.1.1","tape":"^4.2.2","uglify-js":"^2.6.1"},"scripts":{"lint":"eslint . --ignore-path .gitignore","tape":"tape test.js | tap-spec","test":"npm run lint && npm run tape"},"engines":{"iojs":">=2.0.0","node":">=0.12.0"},"gitHead":"72b385350a945f737f28dbdec3a4db90409dc370","_id":"posthtml-inline-assets@1.0.0","_shasum":"4a5db1c202a0e8d9eb6cc355d4baeab752e5fce6","_from":".","_npmVersion":"2.14.3","_nodeVersion":"0.12.5","_npmUser":{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},"dist":{"shasum":"4a5db1c202a0e8d9eb6cc355d4baeab752e5fce6","tarball":"https://registry.npmjs.org/posthtml-inline-assets/-/posthtml-inline-assets-1.0.0.tgz","integrity":"sha512-sAJH8AWmZJcrGOTbo+zfSbADvXGh3t7ix80vLoINPPC1nODZfEpqijQbKKkA0U7A9NxJNfC0oX7h7ZGIkmWSgg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC5sMN0jZFS9S06y+/jnukmG3a/+scyzqQSNQcN2vVXLwIhAOtgVREvYThEJLWrIx3iREn+W5xTWSMCciLzGprsXPtG"}]},"maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"}],"directories":{}},"1.0.1":{"name":"posthtml-inline-assets","version":"1.0.1","description":"Inline external scripts, styles, and images in HTML","keywords":["posthtml","html","posthtml-plugin","inline","assets","javascripts","images","styles","js","img","css"],"author":{"name":"Jonathan Neal","email":"jonathantneal@hotmail.com"},"license":"CC0-1.0","repository":{"type":"git","url":"git+https://github.com/jonathantneal/posthtml-inline-assets.git"},"homepage":"https://github.com/jonathantneal/posthtml-inline-assets","bugs":{"url":"https://github.com/jonathantneal/posthtml-inline-assets/issues"},"dependencies":{"file-type":"^3.3.1","fs-extra":"^0.26.2","fs-promise":"^0.3.1","posthtml":"^0.8.0"},"devDependencies":{"cssnano":"^3.4.0","eslint":"^1.10.3","tap-spec":"^4.1.1","tape":"^4.2.2","uglify-js":"^2.6.1"},"scripts":{"lint":"eslint . --ignore-path .gitignore","tape":"tape test.js | tap-spec","test":"npm run lint && npm run tape"},"engines":{"iojs":">=2.0.0","node":">=0.12.0"},"gitHead":"b1306416bcedc7753e252de761bdfaecf3fe7782","_id":"posthtml-inline-assets@1.0.1","_shasum":"9396df1907f35bc5ae6e7407260bd95d06204ed5","_from":".","_npmVersion":"2.14.3","_nodeVersion":"0.12.5","_npmUser":{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},"dist":{"shasum":"9396df1907f35bc5ae6e7407260bd95d06204ed5","tarball":"https://registry.npmjs.org/posthtml-inline-assets/-/posthtml-inline-assets-1.0.1.tgz","integrity":"sha512-fpVj0bV3WPp3hP/42zG0urRCLwc6n4T4f0wJ9XhHLoOvc6iOY/eQeVaqQQk4wRVm24yXBVv1QiDFBRCI/PG4dA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQChAWDTZrJvM2Ireqao3r+mbCrzBJ+/dWqO5R4JCNy5rgIhANO7Eccg6czxo7mIleSWnP6zE3/JHdhpsoTC4FEmKwvJ"}]},"maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"}],"directories":{}},"1.0.2":{"name":"posthtml-inline-assets","version":"1.0.2","description":"Inline external scripts, styles, and images in HTML","keywords":["posthtml","html","posthtml-plugin","inline","assets","javascripts","images","styles","js","img","css"],"author":{"name":"Jonathan Neal","email":"jonathantneal@hotmail.com"},"license":"CC0-1.0","repository":{"type":"git","url":"git+https://github.com/jonathantneal/posthtml-inline-assets.git"},"homepage":"https://github.com/jonathantneal/posthtml-inline-assets","bugs":{"url":"https://github.com/jonathantneal/posthtml-inline-assets/issues"},"dependencies":{"file-type":"^3.3.1","fs-extra":"^0.26.2","fs-promise":"^0.3.1","posthtml":"^0.8.0"},"devDependencies":{"cssnano":"^3.4.0","eslint":"^1.10.3","tap-spec":"^4.1.1","tape":"^4.2.2","uglify-js":"^2.6.1"},"scripts":{"lint":"eslint . --ignore-path .gitignore","tape":"tape test.js | tap-spec","test":"npm run lint && npm run tape"},"engines":{"iojs":">=2.0.0","node":">=0.12.0"},"gitHead":"d953697bf3639ed6d35ba90086807d2d5b918635","_id":"posthtml-inline-assets@1.0.2","_shasum":"1592669f40a27c8de5f658647ca8d2cafbea2669","_from":".","_npmVersion":"2.14.3","_nodeVersion":"0.12.5","_npmUser":{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},"dist":{"shasum":"1592669f40a27c8de5f658647ca8d2cafbea2669","tarball":"https://registry.npmjs.org/posthtml-inline-assets/-/posthtml-inline-assets-1.0.2.tgz","integrity":"sha512-/10rcJPmXLZfPRXkp6MbS4g+IpyFtSOKJgmipFhXdZ/LCYkwyGTuiO91SHk7RwiGVmANhbYuuf+60/U9NDp+jA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDt20d04E0e414EaF27z+9kUf21Y4EHivDdEzvv91aIXwIgKFyQjE8UYRqfvUsltha50MedARW1gUbqiGGbjymqaKw="}]},"maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"}],"directories":{}},"2.0.0":{"name":"posthtml-inline-assets","version":"2.0.0","description":"Inline external scripts, styles, and images in HTML","author":{"name":"Jonathan Neal","email":"jonathantneal@hotmail.com","url":"http://jonathantneal.com"},"license":"CC0-1.0","repository":{"type":"git","url":"git+https://github.com/jonathantneal/posthtml-inline-assets.git"},"homepage":"https://github.com/jonathantneal/posthtml-inline-assets#readme","bugs":{"url":"https://github.com/jonathantneal/posthtml-inline-assets/issues"},"main":"index.js","files":["index.js","LICENSE.md"],"scripts":{"lint":"eslint . --ignore-path .gitignore","tape":"tape test.js | tap-spec","test":"npm run lint && npm run tape"},"dependencies":{"deep-assign":"^2.0.0","file-type":"^3.9.0","fs-extra":"^0.30.0","fs-promise":"^0.5.0","posthtml":"^0.9.1"},"devDependencies":{"cssnano":"^3.7.7","eslint":"^3.8.1","eslint-config-10up":"github:jonathantneal/eslint-config-10up","tap-spec":"^4.1.1","tape":"^4.6.2","uglify-js":"^2.7.3"},"engines":{"node":">=0.12.0"},"eslintConfig":{"extends":"10up"},"keywords":["posthtml","html","posthtml-plugin","inline","assets","javascripts","images","styles","js","img","css"],"gitHead":"bf168e6f76f2cc1bc5a39d9fdfe7940c45e5904e","_id":"posthtml-inline-assets@2.0.0","_shasum":"f1ea54b3b495fc52643fa363c3932a1030400da9","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.5.0","_npmUser":{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},"dist":{"shasum":"f1ea54b3b495fc52643fa363c3932a1030400da9","tarball":"https://registry.npmjs.org/posthtml-inline-assets/-/posthtml-inline-assets-2.0.0.tgz","integrity":"sha512-r0VP50mDUi37A3i5Xlyzcnqbdj+7pUlOIa3cCNqSzjdcTE2AcT3bVkVcqophXV6IlkSxqg0WB/HjuRuYWA+JQg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDIKNTEKQNB6Bip6AY0rzyC/n86NEoe+D4c/Y2YXMQcswIgOtPe9GWU3QU47PQTv+6tMrI8xW78x3UA05yZL4QEf3o="}]},"maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/posthtml-inline-assets-2.0.0.tgz_1476976435430_0.6601365110836923"},"directories":{}},"3.0.0":{"name":"posthtml-inline-assets","version":"3.0.0","description":"Inline external scripts, styles, and images in HTML","author":{"name":"Jonathan Neal","email":"jonathantneal@hotmail.com"},"license":"CC0-1.0","repository":{"type":"git","url":"git+https://github.com/jonathantneal/posthtml-inline-assets.git"},"homepage":"https://github.com/jonathantneal/posthtml-inline-assets#readme","bugs":{"url":"https://github.com/jonathantneal/posthtml-inline-assets/issues"},"main":"index.cjs.js","module":"index.esm.mjs","scripts":{"prepublishOnly":"npm test","pretest":"rollup -c .rollup.js --silent","test":"npm run test:js && npm run test:tape","test:js":"eslint index.js lib/*.js --cache --ignore-path .gitignore --quiet","test:tape":"node .tape"},"engines":{"node":">=4.0.0"},"dependencies":{"file-type":"^10.4.0","fse":"^4.0.1"},"devDependencies":{"@babel/core":"^7.0.0","@babel/preset-env":"^7.0.0","babel-eslint":"^10.0","cssnano":"^4.1.7","eslint":"^5.8","eslint-config-dev":"2.0","posthtml":"^0.11.3","pre-commit":"^1.2","rollup":"^0.67","rollup-plugin-babel":"^4.0.1","uglify-js":"^3.4.9"},"eslintConfig":{"extends":"dev","parser":"babel-eslint"},"keywords":["posthtml","html","plugin","posthtml-plugin","inline","assets","javascripts","js","images","img","styles","css"],"gitHead":"dc29fb59327dbdc90f72904518d3258410d54776","_id":"posthtml-inline-assets@3.0.0","_npmVersion":"6.4.1","_nodeVersion":"11.0.0","_npmUser":{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},"dist":{"integrity":"sha512-CEFG5YA+JRoIcLYpQNU6z5rFm8FD/97Ikuj0UIsaJP2DqFwqVsIVvQe6mFHiSncouqY1c9j8c7wOd5g57jdAJw==","shasum":"fd3c7c278a610f162fbb0c82e8fd8178ca1685d3","tarball":"https://registry.npmjs.org/posthtml-inline-assets/-/posthtml-inline-assets-3.0.0.tgz","fileCount":6,"unpackedSize":23887,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4dc6CRA9TVsSAnZWagAA2lMP/38WL+fAB3BMGSEPRn32\nH4fUmth3UxsDe1K2pnbvpEU8ccOXHrwWDfB7eiV9ggKzxwe2vMHBuRdEx9rr\nlv8m0CiHSWNCMN1m5z20XUlTXWmJLi/a+bSXEhwmVBF1VdVyRGeOhK8ZZ6sz\n+eybM8O3MzWKQJI1fUjgk77ZLabUO/10dHIRnik2M5f5i1quV5PRLx9OQN8t\noFC5nmsD4y9jT6lknzEygdYA6Eo4RSxMoELvLuQm7iZdB03oLPQcTjBX5DnF\n+N+VigJUfHWd7C13Dh3vSelLhdCmKaPrcL5WTWmxQBbCRCsGdZvewCyARYwL\nrRrbrjB0dfOQU18p51mFQOUdLucGg1vzoXIjseaDYYkH87WG335QjW2YhIpZ\nlA2dChG+Y8C16mA7W5u/HyptmoRnS2zCyD1zzVcNFkd7b2UybA91n0zot6NY\nQe0NB9eZ1chQQNBGTOrHDCbWD9ydKmRFETrdNId57DUCpt7f9ZI9uNIvLBKL\npu1/HIAULY2x1MpmXLH3Sy/v1llQUq7WbCwcCLwoa1dr5lynOHXvHQ/fP4vj\nXpXaPzIHkKxiPvVyMpJiR9ioQ+WUZmpFc63HOskqXfOvO+B63HP4jLwgRvEm\nCilPorJL6L5NoICTgvU/79md2EJrrQQe3W8RpvAiyxiQu+MI1hVq3+FDnFKi\nivzD\r\n=cCgu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHxhCHga3fyM8Us34dVB9Jof8ge+xqOYfI3tPEWqbPnbAiAVAlRhiSf/67BkmRoLthL1gL4ZiD3tSLX7glXd8nNVcw=="}]},"maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/posthtml-inline-assets_3.0.0_1541527353676_0.5715576921033618"},"_hasShrinkwrap":false},"3.1.0":{"name":"posthtml-inline-assets","version":"3.1.0","description":"Inline external scripts, styles, and images in HTML","author":{"name":"Jonathan Neal","email":"jonathantneal@hotmail.com"},"license":"CC0-1.0","repository":{"type":"git","url":"git+https://github.com/jonathantneal/posthtml-inline-assets.git"},"homepage":"https://github.com/jonathantneal/posthtml-inline-assets#readme","bugs":{"url":"https://github.com/jonathantneal/posthtml-inline-assets/issues"},"main":"index.cjs.js","module":"index.esm.mjs","scripts":{"prepublishOnly":"npm test","pretest":"rollup -c .rollup.js --silent","test":"npm run test:js && npm run test:tape","test:js":"eslint index.js lib/*.js --cache --ignore-path .gitignore --quiet","test:tape":"node .tape"},"engines":{"node":">=4.0.0"},"dependencies":{"file-type":"^10.4.0","fse":"^4.0.1"},"devDependencies":{"@babel/core":"^7.0.0","@babel/preset-env":"^7.0.0","babel-eslint":"^10.0","cssnano":"^4.1.7","eslint":"^5.8","eslint-config-dev":"2.0","posthtml":"^0.11.3","pre-commit":"^1.2","rollup":"^0.67","rollup-plugin-babel":"^4.0.1","uglify-js":"^3.4.9"},"eslintConfig":{"extends":"dev","parser":"babel-eslint"},"keywords":["posthtml","html","plugin","posthtml-plugin","inline","assets","javascripts","js","images","img","styles","css"],"gitHead":"5293770975d5b15ae7f2145bf8ef968c81ef8d4e","_id":"posthtml-inline-assets@3.1.0","_nodeVersion":"13.8.0","_npmVersion":"6.13.7","dist":{"integrity":"sha512-52VGs/FG8NNlzv04jZe1HBy5pQ+HWifbQpZN5q0tt6QNkgy3SZCutf4UZyM93uzYym71tKPCQkzAXN3XnRSTgA==","shasum":"a245e65c6a9999e7b38d893f3982f108d725a906","tarball":"https://registry.npmjs.org/posthtml-inline-assets/-/posthtml-inline-assets-3.1.0.tgz","fileCount":6,"unpackedSize":24445,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeV+1mCRA9TVsSAnZWagAAGA8P/1UvTgS84Wrikw1qRyTO\nelA7qQ8nppYtUZg8mzYt4Uey3fE26y9zBJl9dmv6rVLR5HfKVibzEUpzz9Za\nEn6PS5oWs0RyFB2ljd/Dtum4qzRN/QCuDB0NDv43oUJ1kg9EgDIWK5Cb8bEl\n0oNlN3h1j8Laj3UFNYWRZakoESUPvVnn3BnnRNhOKgFiWd8l+fZv6fJgTPTw\ngYPU1STnDipwQRkjkJYxK/nEp+mS6MlGrv76R+BJDvQWCuJADVJVSsIsHG3y\n83vCZJENfRHz3aH4G1dkjwU5x2bjfGcSLfcotTmP7hl6RvchI6kp9snh+Jmh\nRPYfw6KEf9t420vLr4NKlj5UnsdiFV8gFC6gm0QadTFLIv5ToqbST3rbPHbC\nJMdleHAuUPojGWP6OBp93szpe6x+MPt8lsrN9a7G+3pmxeDYCjig7/CXBCbg\nYM2z7afq/xF2mwgsy7c1l2z2HUCfYhgd2PPvjGTddwaDdeDx1SaK7sqPPb1z\nIFDGcLdznV4B9rs4jFD4flHdlrjmA0Yoz3RQvybepAO9BiCtrDIKqRxnAhGH\nShKS/XxH4S0eINx23ZGTo41PUBba5QJV/nLufi+HMM2OaPwNGZKFITgZNyXY\nbSGaDS9bFUX8x+0BhrlaCjxUFOAZq7FyToV2T6+5VomWybK6MYF+AupVVTVS\nvfMe\r\n=jsjh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIErgC+ga6j1tNufzRPFOK53AjD8yNjfVaUxcIZhlWVBwAiEA4PLMN+JF9eo8/0osBSB5PPL3Ec263IWyFd7RN1INH0k="}]},"maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"}],"_npmUser":{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/posthtml-inline-assets_3.1.0_1582820709475_0.566878667450587"},"_hasShrinkwrap":false}},"readme":"# PostHTML Inline Assets [<img src=\"https://posthtml.github.io/posthtml/logo.svg\" alt=\"PostHTML\" width=\"90\" height=\"90\" align=\"right\">](posthtml)\n\n[<img alt=\"npm version\" src=\"https://img.shields.io/npm/v/posthtml-inline-assets.svg\" height=\"20\">](https://www.npmjs.com/package/posthtml-inline-assets)\n[<img alt=\"build status\" src=\"https://img.shields.io/travis/jonathantneal/posthtml-inline-assets/master\" height=\"20\">](https://travis-ci.org/jonathantneal/posthtml-inline-assets?branch=master)\n[<img alt=\"support chat\" src=\"https://img.shields.io/badge/support-chat-blue.svg\" height=\"20\">](https://gitter.im/posthtml/posthtml)\n\n[PostHTML Inline Assets] lets you inline external scripts, styles, and images\nin HTML.\n\n```html\n<link href=\"body.css\" rel=\"stylesheet\" class=\"body-style\">\n\n<!-- becomes -->\n\n<style class=\"body-style\">body { background-color: black; color: white; }</style>\n```\n\n## Usage\n\nAdd **PostHTML Inline Assets** to your project:\n\n```bash\nnpm install posthtml-inline-assets --save-dev\n```\n\nUse **PostHTML Inline Assets** to process your HTML:\n\n```js\nconst posthtml = require('posthtml')\nconst posthtmlInlineAssets = require('posthtml-inline-assets')\n\nposthtml([\n  posthtmlInlineAssets(/* pluginOptions */)\n]).process(YOUR_HTML /*, processOptions */)\n```\n\n#### Gulp\n\nAdd [Gulp PostHTML] to your build tool:\n\n```bash\nnpm install gulp-posthtml --save-dev\n```\n\nUse [PostHTML Inline Assets] in your Gulpfile:\n\n```js\nconst posthtml = require('gulp-posthtml');\nconst posthtmlInlineAssets = require('posthtml-inline-assets');\n\ngulp.task('css', () => gulp.src('./src/*.css').pipe(\n  posthtml([\n    posthtmlInlineAssets()\n  ])\n).pipe(\n  gulp.dest('.')\n));\n```\n\n#### Grunt\n\nAdd [Grunt PostHTML] to your build tool:\n\n```bash\nnpm install grunt-posthtml --save-dev\n```\n\nUse [PostHTML Inline Assets] in your Gruntfile:\n\n```js\nconst posthtmlInlineAssets = require('posthtml-inline-assets');\n\ngrunt.loadNpmTasks('grunt-posthtml');\n\ngrunt.initConfig({\n  posthtml: {\n    options: {\n      use: [\n       posthtmlInlineAssets()\n      ]\n    },\n    dist: {\n      src: '*.css'\n    }\n  }\n});\n```\n\n## Options\n\n### cwd\n\nThe `cwd` option specifies the working directory used by an HTML file, and it\nis used to determine the relative location of assets. By default, the current\nfile directory is used, otherwise the current working directory is used.\n\n```js\nconst posthtmlInlineAssets = require('posthtml-inline-assets');\n\nposthtmlInlineAssets({\n  cwd: '/path/to/files'\n});\n```\n\n```html\n<!-- resolves to /path/to/files/body.css -->\n<link href=\"body.css\" rel=\"stylesheet\" class=\"body-style\">\n```\n\n### root\n\nThe `root` option specifies the root directory used by an HTML file, and it\nis used to determine the absolute location of assets. By default, the current\nfile directory is used, otherwise the current working directory is used.\n\n```js\nconst posthtmlInlineAssets = require('posthtml-inline-assets');\n\nposthtmlInlineAssets({\n  root: '/path/to/files'\n});\n```\n\n```html\n<!-- resolves to /path/to/files/body.css -->\n<link href=\"/body.css\" rel=\"stylesheet\" class=\"body-style\">\n\n<!-- resolves to the current working directory + body.css -->\n<link href=\"body.css\" rel=\"stylesheet\" class=\"body-style\">\n```\n\n### errors\n\nThe `errors` option specifies how transform errors should be handled,\nwhether those errors occur when a resolved asset cannot be read, or when\nsomething goes wrong while an asset is being transformed. The default\nbehavior is to `ignore` these errors, but they may also `throw` an error,\nor log a `warning`.\n\n```js\nconst posthtmlInlineAssets = require('posthtml-inline-assets');\n\nposthtmlInlineAssets({\n  // throw an error whenever a resolved asset fails to inline\n  errors: 'throw' // the options are to 'throw', 'warn', or 'ignore' errors\n});\n```\n\n### transforms\n\nThe `transforms` option specifies the transforms used to inline assets. New\ntransforms can be added by creating a child object with two functions;\n`resolve` and `transform`.\n\n#### resolve\n\nThe `resolve` function is used to determine the path of an asset. It is passed\nthe current node, and it must return the path of the asset to be inlined. If it\ndoes not return a string, the asset will not be transformed.\n\n```js\nfunction resolve(node) {\n  // if the node is a <foo> element then always return 'some/path'\n  return node.tag === 'foo' && 'some/path'; \n}\n```\n\n#### transform\n\nThe `transform` function is used to transform the asset being inlined. It is\npassed the current node as well as an object containing the `buffer`, the full\n`path`, and the `mime` type (if available) of the asset. It may also return a\npromise if an asynchronous transform is required.\n\n```js\nfunction transform(node, { buffer, path, mime }) {\n  // always inline the contents as a child of the node\n  node.content = [ buffer.toString('utf8') ];\n}\n```\n\n### Examples of changing or creating transforms\n\nThe default transforms can be modified to alter their functionality. For\ninstance, `script.resolve` might be changed so that `<script>` elements with a\n`type` attribute are ignored.\n\n```js\nconst posthtmlInlineAssets = require('posthtml-inline-assets');\n\nposthtmlInlineAssets({\n  transforms: {\n    script: {\n      resolve(node) {\n        // transform <script src=\"file.js\"> but not <script src=\"file.js\" type>\n        return node.tag === 'script' && node.attrs && !node.attrs.type && node.attrs.src;\n      }\n    }\n  }\n});\n```\n\nThe transform could also be removed entirely by passing the transform a\nnon-object.\n\n```js\nconst posthtmlInlineAssets = require('posthtml-inline-assets');\n\nposthtmlInlineAssets({\n  transforms: {\n    // any non-object will work\n    script: false\n  }\n});\n```\n\nNew transforms are easy to add. For instance, a new `pics` object might be\nadded to inline `<picture>` elements with a `src` attribute.\n\n```js\nconst posthtmlInlineAssets = require('posthtml-inline-assets');\n\nposthtmlInlineAssets({\n  transforms: {\n    pics: {\n      resolve(node) {\n        return node.tag === 'picture' && node.attrs && node.attrs.src;\n      },\n      transform(node, data) {\n        node.tag = 'img';\n\n        node.attrs.src = 'data:' + data.mime + ';base64,' + data.buffer.toString('base64');\n      }\n    }\n  }\n});\n```\n\nBe creative with your transforms. For instance, `script.transform` might be\nchanged so that the contents of the script are also minified.\n\n```js\nconst posthtmlInlineAssets = require('posthtml-inline-assets');\nconst uglify = require('uglify-js');\n\nposthtmlInlineAssets({\n  transforms: {\n    script: {\n      transform(node, data) {\n        delete node.attrs.src;\n\n        node.content = [\n          uglify.minify(data.buffer.toString('utf8')).code\n        ];\n      }\n    }\n  }\n});\n```\n\n[Gulp PostHTML]: https://github.com/posthtml/gulp-posthtml\n[Grunt PostHTML]: https://github.com/TCotton/grunt-posthtml\n[PostHTML Inline Assets]: https://github.com/jonathantneal/posthtml-inline-assets\n[PostHTML]: https://github.com/posthtml/posthtml\n","maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"}],"time":{"modified":"2022-06-24T11:30:01.789Z","created":"2015-12-11T03:37:53.418Z","1.0.0":"2015-12-11T03:37:53.418Z","1.0.1":"2015-12-11T04:11:31.812Z","1.0.2":"2015-12-11T22:13:47.028Z","2.0.0":"2016-10-20T15:13:56.026Z","3.0.0":"2018-11-06T18:02:33.880Z","3.1.0":"2020-02-27T16:25:09.586Z"},"homepage":"https://github.com/jonathantneal/posthtml-inline-assets#readme","keywords":["posthtml","html","plugin","posthtml-plugin","inline","assets","javascripts","js","images","img","styles","css"],"repository":{"type":"git","url":"git+https://github.com/jonathantneal/posthtml-inline-assets.git"},"author":{"name":"Jonathan Neal","email":"jonathantneal@hotmail.com"},"bugs":{"url":"https://github.com/jonathantneal/posthtml-inline-assets/issues"},"license":"CC0-1.0","readmeFilename":"README.md"}