使用gulp-iconfont时,字体不会改变,但修改了git

时间:2016-08-22 12:10:25

标签: javascript node.js git gulp

字体不变。

git status已被修改。

当字体更改为git识别时。

资产路径

$ tree app/assets/
app/assets/
├── fonts
│   ├── app
│   │   └── assets
│   │       └── scss
│   │           └── utility
│   │               └── _iconfonts.scss
│   ├── iconfonts.eot
│   ├── iconfonts.svg
│   ├── iconfonts.ttf
│   ├── iconfonts.woff
│   └── iconfonts.woff2
├── iconfonts
│   ├── a.svg
│   ├── b.svg
└── scss
    ├── _iconfontsTemplate.scss
    └── utility

gulpfile.js

const gulp        = require('gulp');
const svgmin      = require('gulp-svgmin');
const iconfontCss = require('gulp-iconfont-css');
const iconfont    = require('gulp-iconfont');
const src = './app/assets';

gulp.task('iconfonts', ['create-iconfonts'], () => {
  gulp.src(`${src}/fonts/*`)
    .pipe(gulp.dest('./dist'));
});

gulp.task('create-iconfonts', (callback) => {
  gulp.src(`${src}/iconfonts/*.svg`)
    .pipe(svgmin())
    .pipe(iconfontCss({
      fontName: 'iconfonts',
      path: `${src}/scss/_iconfontsTemplate.scss`,
      targetPath: `${src}/scss/utility/_iconfonts.scss`,
      fontPath: `${src}/fonts`
    }))
    .pipe(iconfont({
      fontName: 'iconfonts',
      formats: ['ttf', 'eot', 'woff', 'woff2', 'svg'],
      appendCodepoints: false
    }))
    .pipe(gulp.dest(`${src}/fonts`))
    .on('end', () => { callback() });
});

目前的git状态

$ git status
On branch test/hoge
nothing to commit, working directory clean

到目前为止,非常好。

字体不变。

但是,以下命令被修改为git。

$ ./node_modules/.bin/gulp create-iconfonts

Git修改如下。

$ git status
On branch test/hoge
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   app/assets/fonts/iconfonts.eot
        modified:   app/assets/fonts/iconfonts.ttf
        modified:   app/assets/fonts/iconfonts.woff
        modified:   app/assets/fonts/iconfonts.woff2

no changes added to commit (use "git add" and/or "git commit -a")

你有什么好主意吗?

感谢。

0 个答案:

没有答案