MMF-FE / svgicon

SVG icon components and tool set
https://mmf-fe.github.io/svgicon
MIT License
922 stars 95 forks source link

Nuxt reloading sometimes update icon lastMod timestamp #141

Closed dawid-pstrak-rmtcfm-com closed 2 years ago

dawid-pstrak-rmtcfm-com commented 3 years ago

Nuxt reloading sometimes update icon lastMod timestamp. Would be nice if there will be option to disable lastMod timestamp, becuase when it gets updated, I have to remove it from git changed files to not push all icons to repo again with just updated timestamp

inouetakuya commented 3 years ago

@dawid-pstrak-rmtcfm-com

Hi, I'm guessing you're using nuxt-svgicon instead of vue-svgicon?

(I searched the svgicon source code, but couldn't find anything named lastMod)

Actually, the build process of nuxt-svgicon is almost the same as that of vue-svgicon, but different.

Some processes, such as the handling of lastMod, are different.

If you are using nuxt-svgicon and suffering from lastMod, I suggest you prepare your own template.

Example

nuxt.config.js

{
  // ...
  modules: [
    [
      'nuxt-svgicon',
      {
        tpl: 'nuxt-svgicon.template.txt',
      },
    ],
  ],
}

nuxt-svgicon.template.txt

/* eslint-disable */
/* tslint:disable */
// @ts-ignore
import icon from 'vue-svgicon'
icon.register({
  '${name}': {
    width: ${width},
    height: ${height},
    viewBox: ${viewBox},
    data: '${data}'
  }
})

See: https://github.com/dschewchenko/nuxt-svgicon