GithubHelp home page GithubHelp logo

typograf-loader's Introduction

typograf-loader

Typograf loader module for webpack. Uses https://github.com/typograf/typograf

Issues with the output should be reported on the typograf issue tracker.

Install

$ npm install --save-dev typograf-loader

Usage

Documentation: Using loaders

In your webpack.config.js, add the typograf-loader, chained with the other loaders.

This outputs processed html file with file-loader:

loaders: [
  {
    test: /ru\.html$/,
    loaders: [
      'file?name=[name].[ext]',
      'typograf?lang=ru&mode=name'
    ]
  }
]

Or to process markdown texts:

loaders: [
  {
    test: /ru\.md$/,
    loaders: [
      'html',
      'typograf?lang=ru&mode=name',
      'markdown'
    ]
  }
]

Options

Full documentation can be found here: https://github.com/typograf/typograf

List of rules

lang

Set text language.

Type: string
Default: en
Options: en | ru

mode

Set output style.

Type: string
Default: default
Options: default | name | digit

  • default: utf-8 symbols
  • name: html special characters with name: &hellip
  • digit: html special characters in numbers form: &#8230

enable

Enables rule.

Type: string | [ string, ... ]
Default: []
Options: * | Rules

disable

Disables rule.

Type: string | [ string, ... ]
Default: []
Options: * | Rules

Examples

Passing options as query string:

...
loaders: [
  {
    test: /ru\.html$/,
    loaders: [
      'typograf?lang=ru&mode=name&enable[]=ru/optalign/*&disable[]=ru/money/ruble',
    ]
  }
]
...

Passing options from object as JSON string:

...
loaders: [
  {
    test: /ru\.html$/,
    loaders: [
      'typograf?' + JSON.stringify({
        lang: 'ru',
        mode: 'name',
        enable: [ 'ru/optalign/*' ],
        disable: [ 'ru/money/ruble' ]
      }),
    ]
  }
]
...

typograf-loader's People

Contributors

exah avatar

Watchers

James Cloos avatar Alexander Plesovskikh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.