Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't include XML prologue, DOCTYPE, etc. in generated SVG sprite file when using inline symbol mode #2

Closed
troywarr opened this issue Jan 2, 2015 · 3 comments

Comments

@troywarr
Copy link

troywarr commented Jan 2, 2015

In my project, I'm using the following gulp task:

gulp.task('svg-icons', function() {
  return gulp
    .src("./src/icons/**/*.svg")
    .pipe(plumber(handleError))
    .pipe(svgSprite({
      mode: {
        symbol: {
          inline: true,
          example: true
        }
      }
    }))
    .pipe(gulp.dest('./dist'));
});

Running it creates the following file structure:

dist/
  symbol/
    svg/
      sprite.symbol.svg
    sprite.symbol.html

My expectation is that since I've set mode.symbol.inline in my config object to true, the file sprite.symbol.svg would only consist of the <svg> element and any nested elements/content (i.e., not the XML namespace declaration, DOCTYPE, etc.). In another step of my build process, I'm including the full output of sprite.symbol.svg in my main HTML file, so only the <svg> element and its contents are needed there (otherwise I'll need to strip them somehow).

Does this seem like a bug, or am I not understanding (or using) the inline option correctly?

Great work here, BTW!

@jkphl
Copy link
Collaborator

jkphl commented Jan 2, 2015

Hi @troywarr,

to answer your last question first: I'd consider it a bug — with an easy short-term solution:

To quickly get rid of the the XML and doctype declaration, simply use the two coresponding config options.

And of course you are right, when using the inline option, these parts shouldn't be generated by default. I will have a look at it!

Cheers,
Joschi

@jkphl
Copy link
Collaborator

jkphl commented Jan 3, 2015

As of release f57a1d2, gulp-svg-sprites shouldn't create XML and doctype declarations for inline sprites anymore. Would you please check if this works for you now? I'll close the issue, but please feel free to re-open in case of further problems.

Cheers,
Joschi

@jkphl jkphl closed this as completed Jan 3, 2015
@troywarr
Copy link
Author

troywarr commented Jan 3, 2015

Looks great! After updating, only <svg> and its contents appear in the generated sprite.symbol.svg file.

Thanks so much for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants