{"size": 711, "ext": "js", "max_stars_repo_path": "gulp-tasks/symbol.js", "max_stars_repo_name": "nju33/diz-theme-markdown", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gulp-tasks/symbol.js", "max_issues_repo_name": "nju33/diz-theme-markdown", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gulp-tasks/symbol.js", "max_forks_repo_name": "nju33/diz-theme-markdown", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.5172413793, "max_line_length": 65, "alphanum_fraction": 0.6385372714}
import fs from 'fs';
import svgmin from 'gulp-svgmin';
import svgSymbols from 'gulp-svg-symbols';
import gulpif from 'gulp-if';
import tap from 'gulp-tap';
import tmp from 'tmp';
import exitHook from 'exit-hook';

tmp.setGracefulCleanup();
const tmpfile = tmp.fileSync({postfix: '.svg'});
exitHook(tmpfile.removeCallback);

export default {
  name: 'symbol',
  filePath: null,
  stream(gulp, config) {
    gulp.src('src/symbols/**/*.svg')
      .pipe(svgmin())
      .pipe(svgSymbols({
        svgClassname: 'symbols',
        templates: ['default-svg']
      }))
      .pipe(tap(file => {
        this.filePath = tmpfile.name;
        fs.writeFileSync(tmpfile.name, file.contents.toString());
      }));
  }
}
