0.2.0 • Published 6 years ago

gulp-octicons v0.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

gulp-octicons

Insert octiocns svg path into html file. You can see icons that you can insert at this page.

Install

npm install gulp-octicons --save-dev

Insert octicons

When you want to insert an icons named __icon_name__, use special comments as below.

<!-- octicons:__icon_name__ -->
<!-- endocticons -->

Icon svg rendered with octiocns.__icon_name__.toSVG() will be inserted. See this section for more detail about toSVG().

Example

Task

var octicons = require('gulp-octicons');

gulp.task('octicons', function() {
  gulp.src("src/*.html")
    .pipe(octicons())
    .pipe(gulp.dest('dest'))
});

Before

<!-- octicons:arrow-up -->
<!-- endocticons -->

<!-- octicons:arrow-down -->
<!-- endocticons -->

After

<!-- octicons:arrow-up -->
<svg version="1.1" width="10" height="16" viewBox="0 0 10 16" class="octicon octicon-arrow-up" aria-hidden="true"><path fill-rule="evenodd" d="M5 3L0 9h3v4h4V9h3z"/></svg>
<!-- endocticons -->

<!-- octicons:arrow-down -->
<svg version="1.1" width="10" height="16" viewBox="0 0 10 16" class="octicon octicon-arrow-down" aria-hidden="true"><path fill-rule="evenodd" d="M7 7V3H3v4H0l5 6 5-6z"/></svg>
<!-- endocticons -->

Future Works

  • Take options that octions do
  • Other formats
  • Support Node 4 and 5

License

MIT