jubalm / grunt-fontello

grunt task for downloading fonts from fontello.com
MIT License
45 stars 25 forks source link

Generated CSS file has wrong path to the generated font files. #23

Closed rkingon closed 7 years ago

rkingon commented 9 years ago

Hi, we found that the path within the generated CSS file is always the same: ../font/[font-name]

If the font generated path is changed via fonts property on the Grunt config it's not being used, leading to a 404 if not manually updated.

Thanks for looking into this!

rmckeel commented 8 years ago

I'm seeing this also. Would be great to have a config for output path, with a default for the options.fonts directory passed in.

I'm in progress learning grunt, so in the meantime, here is a straightforward fix for it post-build (we are building to .tmp/fontello-build and only moving out one file):

  grunt.config.set('shell', {
    /**
     * After fontello CSS and font are built (see config/fontello.js),
     * perform stream edit search & replace (../font/ -> /styles/fonts/) and output
     * to a .less file (which is just CSS) for inclusion.
     */
    fontelloFileOperations: {
      command: [
        'sed "s!\.\.\/font\/!/styles/fonts/!g" .tmp/fontello-build/myfont-embedded.css > assets/styles/font-myfont.css'
        'rm -rf .tmp/fontello-build/'
      ].join('&&')
    }
  });

  grunt.loadNpmTasks('grunt-shell');
ericcornelissen commented 7 years ago

Resolved with #12