{"id":15044834,"url":"https://github.com/gggritso/gulp-angular-inline-svg","last_synced_at":"2026-02-02T14:05:39.392Z","repository":{"id":57287441,"uuid":"93757511","full_name":"gggritso/gulp-angular-inline-svg","owner":"gggritso","description":"Combines SVG files into an Angular constant","archived":false,"fork":false,"pushed_at":"2017-09-28T18:28:21.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T02:47:26.000Z","etag":null,"topics":["angular","gulp","svg"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gggritso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-08T14:15:10.000Z","updated_at":"2017-06-08T14:37:25.000Z","dependencies_parsed_at":"2022-08-24T22:51:38.149Z","dependency_job_id":null,"html_url":"https://github.com/gggritso/gulp-angular-inline-svg","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gggritso%2Fgulp-angular-inline-svg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gggritso%2Fgulp-angular-inline-svg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gggritso%2Fgulp-angular-inline-svg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gggritso%2Fgulp-angular-inline-svg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gggritso","download_url":"https://codeload.github.com/gggritso/gulp-angular-inline-svg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247495952,"owners_count":20948132,"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":["angular","gulp","svg"],"created_at":"2024-09-24T20:51:06.866Z","updated_at":"2026-02-02T14:05:34.322Z","avatar_url":"https://github.com/gggritso.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-angular-inline-svg\n\nYou:\n- have SVG files you’d like to use\n- are using Angular 1.x\n- don’t want to use sprites\n\nWe:\n- provide a Gulp task that concatenates your icons into an Angular constant\n\nYou:\n- inject the constant into your components (or create a component wrapper)\n- drop the SVG into your markup using `ng-bind-html` or something similar\n- use CSS to size and style your SVG files in markup\n- celebrate\n\n## Installation\n\n```\nnpm install gulp-angular-inline-svg\n```\n\n## Gulp Example\n\n```\nvar gulp = require( 'gulp' );\nvar icons = require( 'gulp-angular-inline-svg' );\n\ngulp.task( 'icons', function() {\n  gulp.src( './icons/*.svg' )\n    .pipe( icons({\n      module: 'myApp',\n    }) )\n    .pipe( gulp.dest( './' ) );\n});\n```\n\n## Options\nThe task `icons` takes in an options object like so `.pipe( icons( options ) )`. The available options are:\n- `module` the name of the Angular module that goes into the result file\n- `constant` the name of the Angular constant that goes into the result file\n- `file` the result filename\n- `optimize` whether to run the files through SVGO to optimize the markup\n\n## Usage Recommendation\n\nThe best way to use this is through a component like this:\n\n```\nangular\n  .module( 'myApp' )\n  .component( 'svg-icon', {\n    template: '{{ $ctrl.markup }}',\n    controller: mctIconController,\n    bindings: { name: '@' },\n  });\n\nfunction iconController( ICONS, $sce ) {\n  this.markup = $sce.trustAsHtml( ICONS[ this.name] );\n}\n```\n\nwhich you can use in a page like so:\n\n```\n\u003cicon name=\"clock\"\u003e\u003c/icon\u003e\n```\n\n## Under-The-Hood\nA directory like this:\n\n```\nicons/\n├── clock.svg\n└── shopper.svg\n```\n\nWith this gulp file:\n\n```\nvar gulp = require( 'gulp' );\nvar icons = require( 'gulp-angular-inline-svg' );\n\ngulp.task( 'icons', function() {\n  gulp.src( './icons/*.svg' )\n    .pipe( icons({\n      module: 'myApp',\n      constant: 'ICNS',\n      optimize: true,\n      file: 'icns.js',\n    }) )\n    .pipe( gulp.dest( './' ) );\n});\n```\n\nWill create a file called `icns.js` that looks like this:\n\n```\nangular\n  .module( 'myApp' )\n  .constant( 'ICNS', {\n    clock: '\u003csvg version=\"1.0\" encoding=\" etc etc etc \u003c/path\u003e\u003c/svg\u003e',\n    shopper: '\u003csvg version=\"1.0\" encoding=\" etc etc etc \u003c/path\u003e\u003c/svg\u003e',\n  });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgggritso%2Fgulp-angular-inline-svg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgggritso%2Fgulp-angular-inline-svg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgggritso%2Fgulp-angular-inline-svg/lists"}