{"_id":"@anvilco/resource-embedder","_rev":"7-908ced41f52a0e04ad9ea58c4d22dea6","name":"@anvilco/resource-embedder","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.1":{"name":"@anvilco/resource-embedder","version":"0.0.1","author":{"url":"https://github.com/callumlocke","name":"Callum Locke"},"license":"MIT","_id":"@anvilco/resource-embedder@0.0.1","maintainers":[{"name":"allan-anvil","email":"allan@useanvil.com"},{"name":"benogle","email":"ogle.ben@gmail.com"},{"name":"anvilbot","email":"services@useanvil.com"},{"name":"newhouse","email":"c.newhouse@gmail.com"},{"name":"winggo","email":"winggo.tse@gmail.com"},{"name":"fostimus","email":"derekfoster94@gmail.com"}],"homepage":"https://github.com/anvilco/resource-embedder","bugs":{"url":"https://github.com/anvilco/resource-embedder/issues"},"dist":{"shasum":"18fbcc4a07698cd525bc6e916973625ac390920d","tarball":"https://registry.npmjs.org/@anvilco/resource-embedder/-/resource-embedder-0.0.1.tgz","fileCount":30,"integrity":"sha512-Ww3veCgSH5/0mcmX6r+buQvBMO5pqgpzA8502/8EeBWJglnFBkVzWGB8kdXDt02v9VNCL8y224J0zi0eDDlPng==","signatures":[{"sig":"MEQCIGvhyCPYpcRS8QaIiQLhwvb7KKF6HgT+lC0pVJT8wz1nAiBbVny3qnkAO6DMwR9KsSLSKXGbwUbc+0ZqZ7khYiBEPw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":214702,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJismDmACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmohCg//e39f6ZN6Cv3+hHp3L1cnhU9OINKDwip76WkKneF9PknmeZVM\r\n2pik7w4aPn0lJxudnZJIOnIv11ao0UHkjLer2YiBgBXHspKPb21dCToqp3dI\r\nQw4wuDLukH4dH3CpAMVadbuw3o5e4W+00+KWah6k758ytagwKmv8QgEy7BZ8\r\n8LK+WhKry5AUe9FG9DgeiT8jqCGXqx2YjzmHcLjb5eGSfAQ46Pv6iXDPG/SE\r\nly9c02afCVYdrfr/HTfuSSlxFfdsRUF3NaPvxe0teqPFAM3vxGNICj/ZME/9\r\n683smlwxxsaC7CcCXPqCxZ1HarqXh876cK0U+lkPkl2W75ffvH/dP/xqX836\r\nnt/4SU5a1DAOXvgJVd0pmUyQEFRM4p8632I5vfFVgyHzB8eC+WWzcDLG4yPi\r\n/RKcj6PCL26nntfZyHK2C/YPrEnT9KqQTB51Hn3wbuFsu5di9lDt4qPFjWA1\r\nljIV6IUxazwmk7fNBBvR/7VyZrVhwFTAa6onrvQxjWMpKtHDiUf8LJjBiJao\r\nYcpv+9g1snrYMBXSS7tmQ7pEg6+5DDH49jrMab13XKK55mkvae5lO+/e/2cD\r\nhOdUPBtg5L102eizOOXWHZh13BnaVTwJeT/0FWopDsfJECgvGPm3OB4zCHXN\r\nhRA6rkSTOfmwPX3MRa0/HwtNXgWZqRcYFxo=\r\n=JpV+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"grunt nodeunit:all --stack"},"_npmUser":{"name":"newhouse","email":"c.newhouse@gmail.com"},"licenses":[{"type":"MIT"}],"repository":{"url":"https://github.com/anvilco/resource-embedder.git","type":"git"},"description":"Embeds the contents of external scripts and stylesheets into HTML.","directories":{},"dependencies":{"lodash":"~2.4.1","graceful-fs":"~2.0.2","htmlparser2":"~3.5.0","coffee-script":"~1.7.1","@anvilco/reorient-css":"^0.0.1"},"_hasShrinkwrap":false,"devDependencies":{"grunt":"~0.4.1","sugar":"~1.4.1","wrench":"~1.5.4","grunt-cli":"~0.1.9","grunt-contrib-watch":"~0.5.3","grunt-contrib-nodeunit":"~0.2.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-embedder_0.0.1_1655857382345_0.9412178653370935","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@anvilco/resource-embedder","version":"0.0.2","author":{"url":"https://github.com/callumlocke","name":"Callum Locke"},"license":"MIT","_id":"@anvilco/resource-embedder@0.0.2","maintainers":[{"name":"allan-anvil","email":"allan@useanvil.com"},{"name":"benogle","email":"ogle.ben@gmail.com"},{"name":"anvilbot","email":"services@useanvil.com"},{"name":"newhouse","email":"c.newhouse@gmail.com"},{"name":"winggo","email":"winggo.tse@gmail.com"},{"name":"fostimus","email":"derekfoster94@gmail.com"}],"homepage":"https://github.com/anvilco/resource-embedder","bugs":{"url":"https://github.com/anvilco/resource-embedder/issues"},"dist":{"shasum":"7d45f51286ad8a6daaa9ae234ce8c8613d1694ce","tarball":"https://registry.npmjs.org/@anvilco/resource-embedder/-/resource-embedder-0.0.2.tgz","fileCount":30,"integrity":"sha512-z5iefH7L/QqsqrB2vi3QxUWa86Ax3x1HA+2Oi645tlm+ttZMEgRVOddF4SiYc5qSYIc1hGm3zBvU94bLkk05aw==","signatures":[{"sig":"MEUCIQC2mptu4tgTdjKI9GuEivcJqfN4U0zN3YZ2aKfseBroBQIgW04xL4x7/HM8gsZWBXmhzldBLxJzTR9hqS4T4NDftjc=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":214716,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJismLtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqf0BAAlM3Gfz4pg9KU0II3jQk+Q7DVt9m51goQh6L/jMlc+FXFzFXU\r\npDc4G85NgQ8fRPD9kPm9wAFH+xDf90x0LpATVoHxsEAcXLfe1wYTOWCykfDN\r\nA7f+NuETtQv+QBjkIhm1XCrCXKKLG715gjqiOa4KEWg/hlDvMRjKOHw+C2IT\r\n7Ka/A0zULo5RXMXJmoNHRlHfUebVwlpqVibtIknoDbCWiigdX4eq+Kuva9zQ\r\nAgOzdWAmR+dKudQvpIpI8ZOW5QChth5niGT1bLtFRe7wYWDy5rt5M9z1x1jn\r\ny3dN8nUSsyp1HizAhuMvgkOY6T4ubLJmd+QUzXmqGQ0bhBLI1UuVnOKllwoa\r\n3GNMqbDjMFtgpSIF9rQes+HgsnpDp9IM0vCz8cUtrKqJL3AjMbVexq3e4XtD\r\nTn62WMMzJpDuzPgIfQyRIxwE3mDplFx84woq0fPN51p9x1tHADe65O4hgVKC\r\nYJsOoPLMDD4rHPQVokm8oQ5CqFx3hDRLcTXhhTboTVj1UAbveYE/zX48IsEM\r\nFLzBRFFA1UciNi2hvvcXiwqpLIWplra9sj9fqkRXXueU1UHBOSc+g7GXK9EI\r\n/uyK9D6HHybjgijh4sRjrDF9gOji46eb9SkEaPPQA/5RYXwzWW09PjK0Agyw\r\noVZ1MWFYdEjj9n4mXLPkPbIv+9FQYjyTL0w=\r\n=KKEJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"grunt nodeunit:all --stack"},"_npmUser":{"name":"newhouse","email":"c.newhouse@gmail.com"},"licenses":[{"type":"MIT"}],"repository":{"url":"https://github.com/anvilco/resource-embedder.git","type":"git"},"description":"Embeds the contents of external scripts and stylesheets into HTML.","directories":{},"dependencies":{"lodash":"~2.4.1","graceful-fs":"~2.0.2","htmlparser2":"~3.5.0","coffee-script":"~1.7.1","@anvilco/reorient-css":"^0.0.1"},"_hasShrinkwrap":false,"devDependencies":{"grunt":"~0.4.1","sugar":"~1.4.1","wrench":"~1.5.4","grunt-cli":"~0.1.9","grunt-contrib-watch":"~0.5.3","grunt-contrib-nodeunit":"~0.2.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-embedder_0.0.2_1655857900813_0.6763415546864766","host":"s3://npm-registry-packages"}},"0.0.4":{"name":"@anvilco/resource-embedder","version":"0.0.4","author":{"url":"https://github.com/callumlocke","name":"Callum Locke"},"license":"MIT","_id":"@anvilco/resource-embedder@0.0.4","maintainers":[{"name":"allan-anvil","email":"allan@useanvil.com"},{"name":"benogle","email":"ogle.ben@gmail.com"},{"name":"anvilbot","email":"services@useanvil.com"},{"name":"newhouse","email":"c.newhouse@gmail.com"},{"name":"winggo","email":"winggo.tse@gmail.com"},{"name":"fostimus","email":"derekfoster94@gmail.com"}],"homepage":"https://github.com/anvilco/resource-embedder","bugs":{"url":"https://github.com/anvilco/resource-embedder/issues"},"dist":{"shasum":"d7aac91ee49ead0f10ce50844ffd553004d1f8c6","tarball":"https://registry.npmjs.org/@anvilco/resource-embedder/-/resource-embedder-0.0.4.tgz","fileCount":30,"integrity":"sha512-Yd6SPKWzjiUd16LvRHOavj6xmyc7n+vT96K4FP5hGOP4t6QE2Bf3sLstxyQy9jdxt2Yx3mRFNKGJ18CWCYjGDg==","signatures":[{"sig":"MEUCIEuZ2Q19iZ5DtlY5nupqnLOk/C4h5U7WKYI/b608Jl08AiEAz3WWGZbEWK/nsKr8RvqE09bszAcpb4A4h7lV/zH70EY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":214716,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJismMTACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrDxg/7BxDZKx2tnT6vEVQcPeciCV/dYzEfiBb8q+3rbTL5sfPQnQ1A\r\nXnexmbTBhsuwf4wb4bRcBMDHgU8utZfcIJDHlr3IvlFyeFrD2DGgh8DF0lJR\r\n5Dy914cLZPCO8BHHPmfe9gLIEkUSSagHiSBvR1L0JpldgbAICXNseXdkmiSz\r\nb2BESUoo7rW+fqzBV/Bgz6C5WwBQ6ADb61ncLGLVZSzvvOtyA82MxJ62zUGf\r\n2KZNYm5ZpcIGH3ltUkoCA/VhZiVn/m+cNmZ2q936A9nKqLZP9HRVZlJ6friW\r\noL9AICDMxo+M41Ip/w/tBbZshOSdMsxumjEg6ohM1d1iL1xjGvT0vk+CO1JE\r\nePTi1y1DQwwaz2UN0n3b4mB8V2AKzcxU4WQ+C00nIXJIeCXJ/Q5klSpEyN/i\r\n+ucYsPAojjBuMEgG4oLwkpy3ZA9mX9D3KCSmP5QcSB5polxqOUSwmwYTooYF\r\nTN7UIBTmFFVA/mgN7XyvjqMGqGQHsRki7EhDRu7Km0TBhbAulYoUzRqm5eMb\r\n89aI3/zcajiL2rA6RuekVTxL21mG3o2UQFwb5aJTlWsb9q2h2RqxQpZczylk\r\nEnml+oFXMFTmksieTv7xaWjBFOgANfuYo3V6Rmrxq+ox/VU476Mz8Q3e8en+\r\njduSvbjwNzUjrlJtYcJz7Y4aQ2TsR1t2sB8=\r\n=F+Qr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","scripts":{"test":"grunt nodeunit:all --stack"},"_npmUser":{"name":"newhouse","email":"c.newhouse@gmail.com"},"licenses":[{"type":"MIT"}],"repository":{"url":"https://github.com/anvilco/resource-embedder.git","type":"git"},"description":"Embeds the contents of external scripts and stylesheets into HTML.","directories":{},"dependencies":{"lodash":"~2.4.1","graceful-fs":"~2.0.2","htmlparser2":"~3.5.0","coffee-script":"~1.7.1","@anvilco/reorient-css":"^0.0.1"},"_hasShrinkwrap":false,"devDependencies":{"grunt":"~0.4.1","sugar":"~1.4.1","wrench":"~1.5.4","grunt-cli":"~0.1.9","grunt-contrib-watch":"~0.5.3","grunt-contrib-nodeunit":"~0.2.0"},"_npmOperationalInternal":{"tmp":"tmp/resource-embedder_0.0.4_1655857939714_0.7313580582255148","host":"s3://npm-registry-packages"}}},"time":{"created":"2022-06-22T00:23:02.344Z","modified":"2025-11-12T22:03:18.985Z","0.0.1":"2022-06-22T00:23:02.528Z","0.0.2":"2022-06-22T00:31:41.081Z","0.0.4":"2022-06-22T00:32:19.914Z"},"bugs":{"url":"https://github.com/anvilco/resource-embedder/issues"},"author":{"url":"https://github.com/callumlocke","name":"Callum Locke"},"license":"MIT","homepage":"https://github.com/anvilco/resource-embedder","repository":{"url":"https://github.com/anvilco/resource-embedder.git","type":"git"},"description":"Embeds the contents of external scripts and stylesheets into HTML.","maintainers":[{"email":"services@useanvil.com","name":"anvilbot"},{"email":"derekfoster94@gmail.com","name":"fostimus"},{"email":"manggit@gmail.com","name":"manggit"},{"email":"manggit@useanvil.com","name":"manggit_anvil"}],"readme":"# resource-embedder\n\n[![Build Status](https://secure.travis-ci.org/callumlocke/resource-embedder.png?branch=master)](http://travis-ci.org/callumlocke/resource-embedder) [![Dependency Status](https://david-dm.org/callumlocke/resource-embedder.svg)](https://david-dm.org/callumlocke/resource-embedder)\n\n> Also available as a Grunt plugin: [grunt-embed](https://github.com/callumlocke/grunt-embed)\n\nAutomatically embeds the contents of external scripts and stylesheets into HTML markup.\n\nTakes an HTML file path and generates a string of modified markup. Any small external scripts and stylesheets are replaced with inline `<script>...</script>` or `<style>...</style>` elements.\n\nThis reduces the number of HTTP requests in return for inflating your HTML. It's up to you to decide whether this is a good trade-off in your situation.\n\n\n## Usage\n\n    npm install resource-embedder\n\n```javascript\nvar ResourceEmbedder = require('@anvilco/resource-embedder');\n\nvar embedder = new ResourceEmbedder('./app/page.html');\n\nembedder.get(function (markup) {\n  fs.writeFileSync('./dist/page.html', markup);\n});\n```\n\n### Choosing which files to embed\n\nBy default, **any scripts or stylesheets below 5KB in size** will be embedded. You can change this setting in the options.\n\nYou can also manually decide the threshold for each resource using a `data-embed` attribute.\n\nTo always embed a particular resource, regardless of filesize, just include the attribute:\n\n```html\n<script src=\"foo.js\" data-embed></script>\n<link rel=\"stylesheet\" href=\"foo.css\" data-embed>\n```\n\nTo prevent a particular script from ever being embedded, set it to `false` (or `0`):\n\n```html\n<script src=\"foo.js\" data-embed=\"false\"></script>\n<link rel=\"stylesheet\" href=\"foo.css\" data-embed=\"false\">\n```\n\nTo embed a particular resource only if it is below a certain size, specify the maximum number of bytes, or something like `5KB`:\n\n```html\n<script src=\"foo.js\" data-embed=\"2000\"></script>\n<link rel=\"stylesheet\" href=\"foo.css\" data-embed=\"5KB\">\n```\n\n### Options\n\nTo specify options:\n\n`new ResourceEmbedder('./file.html', options);`\n\n...or just: `new ResourceEmbedder(options);`\n\n* `htmlFile` — only required if you don't pass a file path as the first argument to the constructor.\n* `assetRoot` — (optional) – use this if you need to specify the directory that the relative resource URLs will be considered relative to. (By default, it's the same directory as the HTML file.)\n* `threshold` (default: `\"5KB\"`) — all resources below this filesize will be embedded. NB: you can set this to `0` if you want, in which case nothing will be embedded except those resources you mark with a `data-embed` attribute (see above).\n* `stylesheets` (default: `true`) — whether to embed stylesheets.\n* `scripts` (default: `true`) — whether to embed scripts.\n* `deleteEmbeddedFiles` (default: `false`) – whether the external files should be deleted after being embedded.\n\n\n## Contributing\n\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Test your code using [Grunt](http://gruntjs.com/).\n\n\n### Tasks\n\nWhen you're working on a specific module in `src`, e.g. `parse-file-size.coffee`, first run `grunt watch:parse-file-size` in a terminal and keep the window open. Then open `src/parse-file-size.coffee` and `test/parse-file-size_test.coffee` and work on them side-by-side. New test results will appear in the terminal whenever you save either file.\n\nYou can also just do `grunt watch` to watch all modules at once and run all test files whenever anything changes.\n\n\n## Release History\n\n_(Nothing yet)_\n\n\n## License\n\nCopyright (c) 2013 Callum Locke. Licensed under the MIT license.\n\n\n## Wishlist\n\n* Connect/Express middleware\n* ability to specify root for relative paths, in case different from the HTML file\n* remove `data-embed` attributes from elements that don't get embedded, so they don't litter the output markup unnecessarily\n\n","readmeFilename":"README.md"}