typograf-loader

    0.1.1-1 • Public • Published

    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' ]
          }),
        ]
      }
    ]
    ...

    Install

    npm i typograf-loader

    DownloadsWeekly Downloads

    12

    Version

    0.1.1-1

    License

    none

    Last publish

    Collaborators

    • exah