backflip / gulp-iconfont-css

Create an SCSS file mapping the SVG files piped to gulp-iconfont to their codepoints

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

targetPath issue

zawilliams opened this issue · comments

I think I've got the path, targetPath and fontPath configured correctly, but I'm having an issue now with targetPath.

I'm working on a Laravel app and have my gulpfile located in the project root. So my directory structure looks like:

  • /app
  • /public
  • gulpfile.js

My gulp configuration code for this plugin is as follows:

var fontName = 'icons';

gulp.task('icon-font', function(){
    gulp.src(['app/assets/icons/*.svg'])
        .pipe(iconfontcss({
            fontName: fontName,
            path: 'app/assets/scss/templates/_icons.scss',
            targetPath: '../../../app/assets/scss/components/_icons.scss',
            fontPath: '../fonts/'
        }))
        .pipe(iconfont({
            fontName: fontName
        }))
        .pipe(gulp.dest('public/assets/fonts/'));
});

The problem I'm running into is this: the targetPath is supposed to go into app/assets/scss/components/ but its going into public/assets/scss/components instead. It's like "app" is being replaced by "public" in the path.

Am I doing something wrong or is this an issue with the plugin?

I've figured out how to solve the issue: by adding a base to the src.

Here's the src line that I used:

gulp.src(['app/assets/icons/*.svg'], {base: 'app/assets'})

Which version of Gulp are you using?

Using 3.5.6

Hm, weird. I have added a note to the README. Thanks for reporting!
Anyway, this plugin is most likely going to be deprecated and the recommended solution won't have this issue: #9

commented

Option base not works for me.
gulp 3.9.0

Issue still is open.

Hey Iuriy,
could you save your Gulpfile to https://gist.github.com so I can try to reproduce it?

commented

How can I resolve this problem ?
The targetPath creates a subfolder inside the fonts folder that comprises the full working path inside the fonts director.
For example:
fonts/
Users/username/full project path/icons.scss.

The problem occurs in MacOs and Linux. I do not desire to have either additional folders created or _icons.scss.