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

postcss-epub

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-epub - npm Package Compare versions

Comparing version 2.1.0 to 2.2.5

75

index.js

@@ -0,42 +1,53 @@

"use strict";
/**
* Properties to prefix.
*/
var props = [
"hyphens",
"line-break",
"text-align-last",
"text-emphasis",
"text-emphasis-color",
"text-emphasis-style",
"word-break"
];
var postcss = require("postcss"),
props = [
// text
"hyphens",
"line-break",
"text-align-last",
"text-emphasis",
"text-emphasis-color",
"text-emphasis-style",
"word-break",
// writing modes
"writing-mode",
"text-orientation",
"text-combine-upright",
// text to speech
"cue",
"cue-before",
"cue-after",
"pause",
"rest",
"speak",
"speak-as",
"voice-family"
];
/**
* PostCSS plugin to prefix ePub3 properties.
* @param {Object} style
*/
module.exports = function plugin() {
return function(style) {
style.eachDecl(function(decl) {
if (decl.value) {
try {
if (props.indexOf(decl.prop) >= 0) {
decl.insertBefore(decl.clone({prop: "-epub-" + decl.prop}));
}
} catch (err) {
err.message = gnuMessage(err.message, decl.source);
throw err;
}
function plugin(style) {
style.eachDecl(function(decl) {
if (decl.value) {
if (props.indexOf(decl.prop) >= 0) {
decl.parent.insertBefore(decl, decl.clone({prop: "-epub-" + decl.prop}));
}
});
};
};
}
});
}
/**
* return GNU style message
*
* @param {String} message
* @param {Object} source
/*
* ...and export for use...
*/
function gnuMessage(message, source) {
return (source ? (source.file ? source.file : "<css input>") + ":" + source.start.line + ":" + source.start.column : "") + " " + message;
}
module.exports = {
postcss: plugin,
process: function(css, opts) {
return postcss(plugin).process(css, opts).css;
}
};
{
"name": "postcss-epub",
"version": "2.1.0",
"version": "2.2.5",
"description": "PostCSS plugin to prefix ePub3 properties",

@@ -10,3 +10,3 @@ "keywords": [

"epub",
"epub3"
"epub3"
],

@@ -25,4 +25,11 @@ "author": "Ryc O'Chet",

"devDependencies": {
"postcss": "^2.2.5"
"postcss": "^2.2.5",
"test": "^0.6.0"
},
"directories": {
"test": "test"
},
"scripts": {
"test": "node ./test/test.js"
}
}

@@ -5,2 +5,4 @@ # postcss-epub [![Build Status](https://travis-ci.org/Rycochet/postcss-epub.png)](https://travis-ci.org/Rycochet/postcss-epub)

See the [EPUB 3 CSS Profile](http://www.idpf.org/epub/30/spec/epub30-contentdocs.html#sec-css-text) for more information.
**Note:** This will leave the unprefixed property, there are other plugins to remove them if creating ePub3-only files.

@@ -7,0 +9,0 @@

Sorry, the diff of this file is not supported yet

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