L
L
lavezzi12016-04-18 06:29:29
css
lavezzi1, 2016-04-18 06:29:29

How to change npm module in your project?

Hello. There is a gulp-svg-symbol module. Immediately after opening the body adds all the icons. You need to change its template, that is, add display: none; Because now there is a white bar at the top of the page.
How can I do it on my side so that the people who make the pool of my repository also see this change? For them to use it too.

<svg xmlns="http://www.w3.org/2000/svg" style="width:0; height:0; visibility:hidden;"><% if(defs) {%>
  <defs>
      <%= defs %>
  </defs><% } %><% _.forEach( icons, function( icon ){ %>
    <symbol id="<%= icon.id %>" viewBox="<%= icon.svg.viewBox %>"><% if (icon.title) {%>
      <title><%= icon.title %></title><% }%>
      <%= icon.svg.content %>
    </symbol><%
}); %></svg>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Velichko, 2016-04-18
@Zoxon

Most likely your module is not gulp-svg-symbol but gulp-svg-symbols.
You can specify your own templates in the templates parameter. https://www.npmjs.com/package/gulp-svg-symbols#advanced
For him, I have such a task in gulp.

gulp.task('combine-svg-icons', function (cb) {
  return gulp.src(['**/*.svg', '!**/_*.svg'], {cwd: 'source/static/icons'})
    .pipe($.plumber(options.plumber))
    .pipe($.imagemin(options.imagemin))
    .pipe($.svgSymbols({
      title: false,
      id: '%f',
      className: '%f',
      templates: [
        path.join(__dirname, 'source/static/styles/templates/icons-template.styl'),
        path.join(__dirname, 'source/static/styles/templates/icons-template.svg')
      ]
    }))
    .pipe($.if(/\.styl$/, gulp.dest('tmp')))
    .pipe($.if(/\.svg$/, $.rename('icons.svg')))
    .pipe($.if(/\.svg$/, gulp.dest('dest/assets/images')));
});

You can see the full Gulpfile on github https://github.com/zoxon/gulp-front

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question