Socket
Book a DemoInstallSign in
Socket

material-icon-convert

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

material-icon-convert

A simple utility to quickly replace ligature format Material Design icons to their unicode characters.

1.0.0
unpublished
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Material icon converter

npm version node dependencies build status coverage status github issues

A simple utility to quickly replace ligature format Material Design icons to their unicode characters. This allows you to develop using the legible ligature format yet deploy your code using unicode characters for support in crappy browsers Edge.

Installation

# Using npm
npm install material-icon-convert

# Using yarn
yarn add material-icon-convert

Basic usage

//Load the library and specify options
const convert = require('material-icon-convert');
const options = {
  files: 'path/to/files/**/*.html',
  className: 'material-icons',
  inverse: false, //Specify true to convert from character code to ligatures
};

Asynchronous replacement with promises

convert(options)
  .then(changes => {
    console.log('Modified files:', changes.join(', '));
  })
  .catch(error => {
    console.error('Error occurred:', error);
  });

Asynchronous replacement with callback

convert(options, (error, changes) => {
  if (error) {
    return console.error('Error occurred:', error);
  }
  console.log('Modified files:', changes.join(', '));
});

Synchronous replacement

try {
  const changes = convert.sync(options);
  console.log('Modified files:', changes.join(', '));
}
catch (error) {
  console.error('Error occurred:', error);
}

Return value

The return value of the library is an array of file names of files that were modified (e.g. had some of the contents replaced). If no replacements were made, the return array will be empty.

const changes = convert.sync({
  files: 'path/to/files/**/*.html',
  className: 'material-design',
});

console.log(changes);

// [
//   'path/to/files/file1.html',
//   'path/to/files/file3.html',
//   'path/to/files/file5.html',
// ]

Advanced usage

This library uses replace-in-file under the hood to make the replacements, so check out that package for more advanced usage options.

License

(MIT License)

Copyright 2015-2017, Adam Reis

Keywords

material

FAQs

Package last updated on 01 Feb 2018

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.