[
  {
    "path": ".gitignore",
    "content": "node_modules/\nnpm-debug.log\n*.sublime-*\n"
  },
  {
    "path": ".travis.yml",
    "content": "language: node_js\ncache:\n  directories:\n    - node_modules\n    - ~/.npm\nnode_js:\n  - \"9\"\n  - \"7.6\"\nafter_success:\n  - npm run travis-deploy-once \"npm run semantic-release\"\nbranches:\n  except:\n    - /^v\\d+\\.\\d+\\.\\d+$/\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2014 Filip Malinowski\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# gulp-inline-source\n\n[![NPM Version](https://img.shields.io/npm/v/gulp-inline-source.svg?style=flat-square)](https://www.npmjs.com/package/gulp-inline-source)\n[![Build Status](https://img.shields.io/travis/fmal/gulp-inline-source/master.svg?style=flat-square)](http://travis-ci.org/fmal/gulp-inline-source) \n[![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](http://commitizen.github.io/cz-cli/)\n\n> Inline all `<script>`, `<link>` and `<img>` tags that contain the `inline` attribute with [inline-source](https://github.com/popeindustries/inline-source).\n\n## How it works\n\n```html\n<!-- located at src/html/index.html -->\n<html>\n  <head>\n    <!-- inline src/js/inlineScript.js -->\n    <script src=\"../js/inlineScript.js\" inline></script>\n  </head>\n  <body>\n  </body>\n</html>\n```\n\n```js\n// located at src/js/inlineScript.js\n\nfunction test() {\n  var foo = 'lorem ipsum';\n  return foo;\n}\n```\n\nOutput:\n```html\n<html>\n  <head>\n    <script>function test(){var a=\"lorem ipsum\";return a}</script>\n  </head>\n  <body>\n  </body>\n</html>\n```\n\n## Install\n\n```bash\n$ npm install gulp-inline-source --save-dev\n```\n\n## Usage\n\n```javascript\nvar gulp = require('gulp');\nvar inlinesource = require('gulp-inline-source');\n\ngulp.task('inlinesource', function () {\n    return gulp.src('./src/*.html')\n        .pipe(inlinesource())\n        .pipe(gulp.dest('./out'));\n});\n```\n\nOptionally, you can provide [some options](https://github.com/popeindustries/inline-source#usage) through an options object:\n\n```javascript\nvar gulp = require('gulp');\nvar inlinesource = require('gulp-inline-source');\n\ngulp.task('inlinesource', function () {\n    var options = {\n        compress: false\n    };\n\n    return gulp.src('./src/*.html')\n        .pipe(inlinesource(options))\n        .pipe(gulp.dest('./out'));\n});\n```\n"
  },
  {
    "path": "index.js",
    "content": "'use strict';\n\nconst { inlineSource } = require('inline-source');\nconst PluginError = require('plugin-error');\nconst path = require('path');\nconst through = require('through2');\n\nconst PLUGIN_NAME = 'gulp-inline-source';\n\nfunction gulpInlineSource (options) {\n    return through.obj(function (file, enc, cb) {\n        var self = this;\n\n        if (file.isNull() || file.isDirectory()) {\n            this.push(file);\n            return cb();\n        }\n\n        if (file.isStream()) {\n            this.emit('error', new PluginError(PLUGIN_NAME, 'Streaming not supported'));\n            return cb();\n        }\n\n        var fileOptions = {\n            rootpath: path.dirname(file.path),\n            htmlpath: file.path\n        };\n\n        if (options) {\n            for (var i in options) {\n                fileOptions[i] = options[i];\n            }\n        }\n\n        inlineSource(file.contents.toString(), fileOptions)\n            .then(html => {\n                file.contents = Buffer.from(html || '');\n                self.push(file);\n                cb();\n            })\n            .catch(err => {\n                self.emit('error', new PluginError(PLUGIN_NAME, err));\n            });\n    });\n}\n\nmodule.exports = gulpInlineSource;\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"gulp-inline-source\",\n  \"version\": \"0.0.0-development\",\n  \"description\": \"Inline flagged js & css sources.\",\n  \"license\": \"MIT\",\n  \"author\": \"Filip Malinowski <filip@fmal.me>\",\n  \"repository\": \"git://github.com/fmal/gulp-inline-source.git\",\n  \"keywords\": [\n    \"gulpplugin\",\n    \"inline\",\n    \"css\",\n    \"javascript\"\n  ],\n  \"engines\": {\n    \"node\": \">=7.6\"\n  },\n  \"scripts\": {\n    \"test\": \"tape test/*.js | faucet\",\n    \"commit\": \"git-cz\",\n    \"commitmsg\": \"validate-commit-msg\",\n    \"prepush\": \"npm test\",\n    \"semantic-release\": \"semantic-release\",\n    \"travis-deploy-once\": \"travis-deploy-once\"\n  },\n  \"dependencies\": {\n    \"plugin-error\": \"~1.0.1\",\n    \"inline-source\": \"~6.1.8\",\n    \"through2\": \"~2.0.0\"\n  },\n  \"main\": \"index.js\",\n  \"devDependencies\": {\n    \"commitizen\": \"^2.9.6\",\n    \"cz-conventional-changelog\": \"^2.0.0\",\n    \"faucet\": \"0.0.1\",\n    \"husky\": \"^0.13.3\",\n    \"semantic-release\": \"^15.6.0\",\n    \"tape\": \"^4.0.1\",\n    \"travis-deploy-once\": \"^5.0.0\",\n    \"validate-commit-msg\": \"^2.14.0\",\n    \"vinyl\": \"^2.1.0\"\n  },\n  \"config\": {\n    \"commitizen\": {\n      \"path\": \"./node_modules/cz-conventional-changelog\"\n    }\n  }\n}\n"
  },
  {
    "path": "test/expected/inlined-image-png.html",
    "content": "<html>\n  <head>\n  </head>\n  <body>\n    <img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAAKtJREFUaAXt0rERwDAMw0A5+++cuEiHDSD4Tg078n1m5r235j1rmv5FK2wXTzhh2QJ9aRko6iSMSWRBwjJQ1EkYk8iChGWgqJMwJpEFCctAUSdhTCILEpaBok7CmEQWJCwDRZ2EMYksSFgGijoJYxJZkLAMFHUSxiSyIGEZKOokjElkQcIyUNRJGJPIgoRloKiTMCaRBQnLQFEnYUwiCxKWgaJOwphEFqwT/gC5HwF3y7W1swAAAABJRU5ErkJggg==\"/>\n  </body>\n</html>"
  },
  {
    "path": "test/expected/inlined-image-svg.html",
    "content": "<html>\n  <head>\n  </head>\n  <body>\n    <svg width=\"60\" height=\"60\" viewBox=\"0 0 60 60\"><path fill=\"#000\" d=\"M0 0h60v60H0z\" fill-rule=\"evenodd\"/></svg>\n  </body>\n</html>\n"
  },
  {
    "path": "test/expected/inlined-link.html",
    "content": "<html>\n  <head>\n\t<style>.classname{color:red}</style>\n  </head>\n  <body>\n  </body>\n</html>"
  },
  {
    "path": "test/expected/inlined-nominify.html",
    "content": "<html>\n  <head>\n\t<script>function test() {\n  var foo = 'lorem ipsum';\n  return foo;\n}</script>\n\t<style>.classname {\n\tcolor: red;\n}</style>\n  </head>\n  <body>\n  </body>\n</html>"
  },
  {
    "path": "test/expected/inlined-script.html",
    "content": "<html>\n  <head>\n\t<script>function test(){return\"lorem ipsum\"}</script>\n  </head>\n  <body>\n  </body>\n</html>"
  },
  {
    "path": "test/expected/inlined-with-attributes.html",
    "content": "<html>\n  <head>\n\t<script>function test(){return\"lorem ipsum\"}</script>\n\t<style type=\"text/css\" media=\"screen\">.classname{color:red}</style>\n  </head>\n  <body>\n  </body>\n</html>"
  },
  {
    "path": "test/fixtures/image-png.html",
    "content": "<html>\n  <head>\n  </head>\n  <body>\n    <img src=\"image.png\" inline>\n  </body>\n</html>"
  },
  {
    "path": "test/fixtures/image-svg.html",
    "content": "<html>\n  <head>\n  </head>\n  <body>\n    <img src=\"image.svg\" inline>\n  </body>\n</html>\n"
  },
  {
    "path": "test/fixtures/link.html",
    "content": "<html>\n  <head>\n\t<link rel=\"stylesheet\" href=\"style.css\" inline>\n  </head>\n  <body>\n  </body>\n</html>"
  },
  {
    "path": "test/fixtures/nominify.html",
    "content": "<html>\n  <head>\n\t<script src=\"script.js\" inline></script>\n\t<link rel=\"stylesheet\" href=\"style.css\" inline>\n  </head>\n  <body>\n  </body>\n</html>"
  },
  {
    "path": "test/fixtures/script-es6.html",
    "content": "<html>\n  <head>\n\t<script src=\"script-es6.js\" inline></script>\n  </head>\n  <body>\n  </body>\n</html>"
  },
  {
    "path": "test/fixtures/script-es6.js",
    "content": "function test() {\n  const foo = `lorem ipsum`;\n  return foo;\n}"
  },
  {
    "path": "test/fixtures/script-relative.html",
    "content": "<html>\n  <head>\n\t<script src=\"../fixtures/script.js\" inline></script>\n  </head>\n  <body>\n  </body>\n</html>"
  },
  {
    "path": "test/fixtures/script.html",
    "content": "<html>\n  <head>\n\t<script src=\"script.js\" inline></script>\n  </head>\n  <body>\n  </body>\n</html>"
  },
  {
    "path": "test/fixtures/script.js",
    "content": "function test() {\n  var foo = 'lorem ipsum';\n  return foo;\n}"
  },
  {
    "path": "test/fixtures/style.css",
    "content": ".classname {\n\tcolor: red;\n}"
  },
  {
    "path": "test/fixtures/with-attributes.html",
    "content": "<html>\n  <head>\n\t<script src=\"script.js\" inline></script>\n\t<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\" media=\"screen\" inline>\n  </head>\n  <body>\n  </body>\n</html>"
  },
  {
    "path": "test/main.js",
    "content": "'use strict';\n\nconst path = require('path');\nconst Vinyl = require('vinyl');\nconst fs = require('fs');\nconst test = require('tape');\nconst inlinesource = require('../');\n\nfunction getFile (filePath, contents) {\n    return new Vinyl({\n        path: filePath,\n        base: path.dirname(filePath),\n        contents: contents || fs.readFileSync(filePath)\n    });\n}\n\nfunction getFixture (filePath) {\n    return getFile(path.join(__dirname, 'fixtures', filePath));\n}\n\nfunction getExpected (filePath) {\n    return getFile(path.join(__dirname, 'expected', filePath));\n}\n\nfunction compare (stream, fixtureName, expectedName, t) {\n    stream.on('data', function (newFile) {\n        t.equal(String(newFile.contents), String(getExpected(expectedName).contents));\n    });\n\n    stream.on('end', function () {\n        t.end();\n    });\n\n    stream.write(getFixture(fixtureName));\n    stream.end();\n}\n\ntest('inlines <script> tag', function (t) {\n    compare(inlinesource(), 'script.html', 'inlined-script.html', t);\n});\n\ntest('inlines <link> tag', function (t) {\n    compare(inlinesource(), 'link.html', 'inlined-link.html', t);\n});\n\ntest('inlines <img> tag with SVG source', function (t) {\n    compare(inlinesource(), 'image-svg.html', 'inlined-image-svg.html', t);\n});\n\ntest('inlines <img> tag with PNG source', function (t) {\n    compare(inlinesource(), 'image-png.html', 'inlined-image-png.html', t);\n});\n\ntest('works with type and media attributes', function (t) {\n    compare(inlinesource(), 'with-attributes.html', 'inlined-with-attributes.html', t);\n});\n\ntest('works with relative paths', function (t) {\n    compare(inlinesource(), 'script-relative.html', 'inlined-script.html', t);\n});\n\ntest('inlines assets without minification', function (t) {\n    const stream = inlinesource({\n        compress: false\n    });\n\n    compare(stream, 'nominify.html', 'inlined-nominify.html', t);\n});\n\ntest('throws when trying to compress non-ES5 syntax', function (t) {\n    t.plan(1);\n\n    const stream = inlinesource({ compress: true });\n\n    stream.on('error', function (err) {\n        t.pass();\n    });\n\n    stream.on('finish', function () {\n        t.end();\n    });\n\n    stream.write(getFixture('script-es6.html'));\n    stream.end();\n});\n"
  }
]