Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

icon-maker-loader

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

icon-maker-loader

[![Build Status](https://travis-ci.org/unimonkiez/icon-maker-loader.svg?branch=master)](https://travis-ci.org/unimonkiez/icon-maker-loader) # Icon maker loader ##### Webpack loader to load svgs to font files and return the css classes to use that icon.

  • 0.1.11
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-40%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

Icon maker loader

Webpack loader to load svgs to font files and return the css classes to use that icon.

Installation

  • npm install icon-maker-loader
  • if you dont have a css and fonts (eot,svg,ttf,woff) loader, you can use css-loader and url-loader.

Usage

webpack configuration

const path = require('path');

module.exports = {
  ...
  module: {
    loaders: [
      {
        test: /\.svg$/,
        loader: 'icon-maker',
        include: path.join(__dirname, 'icons') // To avoid clash of svgs
      }, {
        test: /\.css$/, // Have to configure css loader for the generated css
        loader: 'css'
      }, {
        test: /\.(woff|eot|ttf|svg)$/, // Have to configure fonts loaders for the generated fonts
        loader: 'url',
        exclude: path.join(__dirname, 'icons') // To avoid clash of svgs
      }
    ]
  }
};

js example (react)

import React, { Component } from 'react';
import yinYan from './icons/yin-yan.svg'; // You get classes `default default-yin-yan`

export default MyComponent extends Component {
  render() {
    return (
      <div>
        Look at my icon!
        <span className={yinYan} />
      </div>
    );
  }
}

html example (requires html-loader)

<div>
  Look at my icon!
  <span class="${require('./icons/yin-yan.svg')}">
  </span>
</div>

parameters (query params to the loader)

  • fontFamily - (default icon-maker), can split your icons to multiple font families (for instance, better loading for different pages of your application).
  • files - (default eot,svg,ttf,woff), can decide which font files will be generated.
  • localCss - (default false) - will generate css with local scope to be used with css-loader (you can also convert all of your classes to local using css-loader?modules and then this option is not needed).

Example of parameters

icon-maker?fontFamily=login&files=eot,svg&localCss

Keywords

FAQs

Package last updated on 01 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc