{"id":13481653,"url":"https://github.com/ludohenin/gulp-inline-ng2-template","last_synced_at":"2026-01-14T14:35:57.904Z","repository":{"id":57257913,"uuid":"41361062","full_name":"ludohenin/gulp-inline-ng2-template","owner":"ludohenin","description":"Gulp plugin to inline HTML and CSS into Angular 2 component decorators","archived":false,"fork":false,"pushed_at":"2022-12-21T14:55:54.000Z","size":185,"stargazers_count":126,"open_issues_count":12,"forks_count":25,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-10-29T19:54:39.378Z","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/ludohenin.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":"2015-08-25T12:06:48.000Z","updated_at":"2023-09-08T17:00:56.000Z","dependencies_parsed_at":"2023-01-30T04:00:52.972Z","dependency_job_id":null,"html_url":"https://github.com/ludohenin/gulp-inline-ng2-template","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/ludohenin/gulp-inline-ng2-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ludohenin%2Fgulp-inline-ng2-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ludohenin%2Fgulp-inline-ng2-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ludohenin%2Fgulp-inline-ng2-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ludohenin%2Fgulp-inline-ng2-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ludohenin","download_url":"https://codeload.github.com/ludohenin/gulp-inline-ng2-template/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ludohenin%2Fgulp-inline-ng2-template/sbom","scorecard":{"id":603149,"data":{"date":"2025-08-11","repo":{"name":"github.com/ludohenin/gulp-inline-ng2-template","commit":"d3fec99662a49520327e87d0d0a30b5436a28d10"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":4,"reason":"Found 6/14 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 22 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"16 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-4vmm-mhcq-4x9j","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-p493-635q-r6gr","Warn: Project is vulnerable to: GHSA-3965-hpx2-q597","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T00:55:33.317Z","repository_id":57257913,"created_at":"2025-08-21T00:55:33.317Z","updated_at":"2025-08-21T00:55:33.317Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28423783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-07-31T17:00:53.754Z","updated_at":"2026-01-14T14:35:57.880Z","avatar_url":"https://github.com/ludohenin.png","language":"JavaScript","funding_links":[],"categories":["Awesome Angular [![Awesome TipeIO](https://img.shields.io/badge/Awesome%20Angular-@TipeIO-6C6AE7.svg)](https://github.com/gdi2290/awesome-angular) [![Awesome devarchy.com](https://img.shields.io/badge/Awesome%20Angular-@devarchy.com-86BDC1.svg)](https://github.com/brillout/awesome-angular-components)","Uncategorized"],"sub_categories":["Angular \u003ca id=\"angular\"\u003e\u003c/a\u003e","Uncategorized"],"readme":"# gulp-inline-ng2-template\n\nInline Angular2 HTML and CSS files into JavaScript ES5/ES6 and TypeScript files (and possibly more - not tested).\n\n[![Build Status](https://travis-ci.org/ludohenin/gulp-inline-ng2-template.svg?branch=master)](https://travis-ci.org/ludohenin/gulp-inline-ng2-template)\n[![npm](https://img.shields.io/npm/dm/gulp-inline-ng2-template.svg?maxAge=2592000)](https://www.npmjs.com/package/gulp-inline-ng2-template)\n\nThis plugin uses the [ES6 template strings](https://github.com/lukehoban/es6features#template-strings) syntax by default _(which requires the use of a transpiler -typescript, babel, traceur- to produce valid ES5 files)_ but you can opt-in for ES5 one.\n\nVery convenient to unit test your component or bundle your components/application (avoid extra HTTP request and keeps your source clean).\n\nBy aggressively inlining templates, component library authors can ensure that their library is\ncompatible with all deployment methods (SystemJS, Webpack, etc.) and avoid problems associated\nwith setting `Component.moduleId` on published components.\n\n\n__note:__\n\n* 5.0.0 - __Breaking changes__\n  * Drop Node 4 support (tested with node 8)\n  * Add sourcemap support [thanks to (dhilgarth](https://github.com/dhilgarth)\n  * Fix deps warnings (thanks to [vkennke](https://github.com/vkennke))\n* 4.0.0 -\n  * Now escapes templates (html \u0026 css) backslashes. You may remove your custom workarounds if any\n  * Proper error handling and propagation\n* 3.0.0 - __Breaking changes__\n  * Change processor function signature\n* 2.0.0 - __Breaking changes__\n  * Refactor the parser and make it async\n  * `templateProcessor` and `styleProcessor` now accept a callback as 3rd argument\n  * If you're not using the processor functions, everything will work as in 1.x.\n* 1.1.5 adds `customFilePath` option\n* 1.1.4 adds `supportNonExistentFiles` option\n* 1.1.0 adds templateFunction when templateUrl is a function\n* 1.0.0 - __Breaking changes__\n  * Add suppport for processors (templates \u0026 styles)\n  * Refactor configuration object (`html` and `css` prop dropped)\n  * Drop jade dependency and related config\n* 0.0.11 adds option to remove line breaks\n* 0.0.10 adds components relative asset paths support (see Configuration)\n* 0.0.8 adds Jade support (add `jade: true` to your config) =\u003e __dropped in 1.0.0__\n* 0.0.6 adds support to style sheets\n\n## TOC\n\n* [Installation](#installation)\n* [Configuration](#configuration)\n  * [Options](#options)\n  * [Processors configuration](#processors-configuration)\n  * [Processor Examples](#processor-examples)\n  * [Template function](#template-function)\n  * [CustomFilePath configuration](#customfilepath-configuration)\n* [Example usage](#example-usage)\n* [Browserify transform example](#browserify-transform-example)\n* [How it works](#how-it-works)\n* [Contribute](#contribute)\n* [Contributors](#contributors)\n* [Todo](#todo)\n* [Licence](#licence)\n\n## Installation\n\n```bash\nnpm install gulp-inline-ng2-template --save-dev\n```\n\n## Configuration\n\n### Options\n\nYou can pass a configuration object to the plugin.\n```javascript\ndefaults = {\n  base: '/',                  // Angular2 application base folder\n  target: 'es6',              // Can swap to es5\n  indent: 2,                  // Indentation (spaces)\n  useRelativePaths: false,    // Use components relative assset paths\n  removeLineBreaks: false,    // Content will be included as one line\n  removeModuleId: false,      // Remove the `moduleId` key from component definition after inlining styles\n  templateExtension: '.html', // Update according to your file extension\n  templateFunction: false,    // If using a function instead of a string for `templateUrl`, pass a reference to that function here\n  templateProcessor: function (path, ext, file, callback) {/* ... */},\n  styleProcessor: function (path, ext, file, callback) {/* ... */},\n  customFilePath: function(ext, file) {/* ... */},\n  supportNonExistentFiles: false // If html or css file do not exist just return empty content\n};\n```\n\n### Processors configuration\n\n```typescript\n/**\n *  Processor function call signature and type return\n *\n * @Param{String}   file path\n * @Param{String}   file extension (type)\n * @Param{String}   file content\n * @Param{Function} callback function (err, result) =\u003e void\n * @Return{void}\n */\nfunction processor(path, ext, file, cb) {\n  // async implementation of your source files processing goes here ...\n  cb(null, file);\n}\n```\n\n### Processor Examples\n\nMinify template file before inlining them\n\n```javascript\nimport inlineTemplate from 'gulp-inline-ng2-template';\nimport htmlMinifier from 'html-minifier';\n\nconst pluginOptions = {\n  base: mySrcPath,\n  templateProcessor: minifyTemplate\n};\n\nfunction minifyTemplate(path, ext, file, cb) {\n  try {\n    var minifiedFile = htmlMinifier.minify(file, {\n      collapseWhitespace: true,\n      caseSensitive: true,\n      removeComments: true,\n      removeRedundantAttributes: true\n    });\n    cb(null, minifiedFile);\n  }\n  catch (err) {\n    cb(err);\n  }\n}\n```\n\n_Credit [@lcrodriguez](https://github.com/lcrodriguez)_\n\n### Template function\n\nInside your component: `templateUrl: templateFunc('app.html')`\n\n```es6\n/**\n *  Template function call signature and type return\n *\n * @Param{String}   filename\n * @Return{String}  returned filename\n */\ntemplateFunction: function (filename) {\n  // ...\n  return newFilename;\n}\n```\n\n### CustomFilePath configuration\n\n```typescript\n/**\n *  Custom function name call signature and type return\n *\n * @Param{String}   file extension (type)\n * @Param{String}   file path\n * @Return{String}  returned file path updated\n */\nfunction customFilePath(ext, file) {\n  return file;\n}\n```\n\n## Example usage\n\n```javascript\n//...\nvar inlineNg2Template = require('gulp-inline-ng2-template');\n\nvar result = gulp.src('./app/**/*.ts')\n  .pipe(inlineNg2Template({ base: '/app' }))\n  .pipe(tsc());\n\nreturn result.js\n  .pipe(gulp.dest(PATH.dest));\n```\n\n## Browserify transform example\n\nExample transform function to use with Browserify.\n\n```javascript\n// ng2inlinetransform.js\nvar ng2TemplateParser = require('gulp-inline-ng2-template/parser');\nvar through = require('through2');\nvar options = {target: 'es5'};\n\nfunction (file) {\n  return through(function (buf, enc, next){\n    ng2TemplateParser({contents: buf, path: file}, options)((err, result) =\u003e {\n      this.push(result);\n      process.nextTick(next);\n    });\n  });\n}\n```\n\n```javascript\n// gulp task\nreturn browserify('main.ts', {} )\n  .add(config.angularApp.additionalFiles)\n  .plugin(require('tsify'), {target: 'es5'})\n  .transform('./ng2inlinetransform')\n  .bundle()\n  .pipe(gulp.dest(config.rootDirectory))\n```\n\n_Thanks to [@zsedem](https://github.com/zsedem)_\n\n## How it works\n\n__app.html__\n```html\n\u003cp\u003e\n  Hello {{ world }}\n\u003c/p\u003e\n```\n\n__app.css__\n```css\n.hello {\n  color: red;\n}\n```\n\n__app.ts__\n```javascript\nimport {Component, View} from 'angular2/angular2';\n@Component({ selector: 'app' })\n@View({\n  templateUrl: './app.html',\n  styleUrls: ['./app.css'],\n  directives: [CORE_DIRECTIVES]\n})\nclass AppCmp {}\n```\n\n__result (app.ts)__\n```javascript\nimport {Component, View} from 'angular2/angular2';\n@Component({ selector: 'app' })\n@View({\n  template: `\n    \u003cp\u003e\n      Hello {{ world }}\n    \u003c/p\u003e\n  `,\n  styles: [`\n    .hello {\n      color: red;\n    }\n  `],\n  directives: [CORE_DIRECTIVES]\n})\nclass AppCmp {}\n```\n\n## Contribute\n\n```bash\ngit clone https://github.com/ludohenin/gulp-inline-ng2-template\ncd gulp-inline-ng2-template\nnpm install\nnpm run test-dev\n```\n\n## Contributors\n\n![Contributors](https://webtask.it.auth0.com/api/run/wt-ludovic_henin-yahoo_com-0/contributors-list/ludohenin/gulp-inline-ng2-template.svg)\n\n## Todo\n\n- [ ] Append styles into `styles` View config property if it exist\n- [ ] Add support for source maps\n- [ ] Add option `skipCommented`\n\n## Licence\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fludohenin%2Fgulp-inline-ng2-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fludohenin%2Fgulp-inline-ng2-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fludohenin%2Fgulp-inline-ng2-template/lists"}