jeerbl/webfonts-loader

There's no option for "@font-face only"

lazytyper opened this issue · 3 comments

The big advantage of ligatures is:

The icon names are already present in the fonts. There is no longer need to create a CSS rule for each icon.

I couldn't find an option for turning off creating those rules and create just the @font-face specification and the fonts.

The webfonts-generator which is used, doesn't support that feature either. So, there's no way to disable creating icon classes.

I've got a solution using regexp-replace-loader as a workaround:

  {
    test: /\.font\.js$/,
    use: [
      MiniCssExtractPlugin.loader,
      {
        loader: 'css-loader',
        options: {
          url: false
        }
      },
      {
        loader: 'regexp-replace-loader',
        options: {
          match: {
            pattern: '\\.[a-z0-9\\-]+:before\\s+\\{[^\\}]+\\}\\s*',
            flags: 'mg'
          },
          replaceWith: ''
        }
      },
      {
        loader: 'webfonts-loader',
        options: { }
      }
    ]
  },

This will remove the icon classes from the CSS code.

Closing as webfonts-generator doesn't include that feature yet.