Skip to content

JayPanoz/postcss-epub-interceptor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

postcss-epub-interceptor

A PostCSS plugin to unprefix EPUB3 properties.

See EPUB 3.1 Mapping for further details.

Warning

This is very alpha (v.0.1) and is more of a proof of concept than an elegant plugin. It gets the job done but is neither elegant nor optimized.

At least it implements the correct mapping for -epub-properties back to EPUB 3.0.0 – I just needed to do a practical implementation in order to get all the details and will redo it from scratch ASAP. In the meantime, please feel free to fork it, improve code and pull request.

Usage

postcss([ require("postcss-epub-interceptor") ])

// postcss.config.js

module.exports = (ctx) => ({
  plugins: [
    require('postcss-epub-interceptor')({ })
  ]
})

Prefixing

If you need to prefix those properties, please use autoprefixer.

Example

Input

.text-1 {
  -epub-hyphens: auto;
  -epub-line-break: normal;
  -epub-text-align-last: center;
  -epub-word-break: break-all;
  text-transform: -epub-fullsize-kana; 
}

.text-2 {
  -epub-hyphens: none;
  hyphens: none;
  text-align-last: center;
  -epub-word-break: break-all;
  word-break: break-all;
  text-transform: -epub-fullwidth;	
}

.text-3 {
  text-transform: -epub-fullwidth;
  text-transform: full-width;
}

Output

.text-1 {
  -epub-hyphens: auto;
  hyphens: auto;
  -epub-line-break: normal;
  line-break: normal;
  -epub-text-align-last: center;
  text-align-last: center;
  -epub-word-break: break-all;
  word-break: break-all;
  text-transform: -epub-fullsize-kana; 
}

.text-2 {
  -epub-hyphens: none;
  hyphens: none;
  text-align-last: center;
  -epub-word-break: break-all;
  word-break: break-all;
  text-transform: -epub-fullwidth;
  text-transform: full-width;	
}

.text-3 {
  text-transform: -epub-fullwidth;
  text-transform: full-width;
}

Notes

The following declarations are not supported:

  • text-transform: -epub-fullsize-kana (CSS Text Level 3 module has dropped support for the fullsize-kana value);
  • -epub-text-combine: horizontal <digit>.

License

MIT

Releases

No releases published

Packages

No packages published