mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-30 22:59:37 +02:00
Start of new epub reader
This commit is contained in:
parent
70ba2f7850
commit
44363f05ac
16 changed files with 1761 additions and 2 deletions
47
server/libs/css/stringify/index.js
Normal file
47
server/libs/css/stringify/index.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var Compressed = require('./compress');
|
||||
var Identity = require('./identity');
|
||||
|
||||
/**
|
||||
* Stringfy the given AST `node`.
|
||||
*
|
||||
* Options:
|
||||
*
|
||||
* - `compress` space-optimized output
|
||||
* - `sourcemap` return an object with `.code` and `.map`
|
||||
*
|
||||
* @param {Object} node
|
||||
* @param {Object} [options]
|
||||
* @return {String}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
module.exports = function(node, options){
|
||||
options = options || {};
|
||||
|
||||
var compiler = options.compress
|
||||
? new Compressed(options)
|
||||
: new Identity(options);
|
||||
|
||||
// source maps
|
||||
if (options.sourcemap) {
|
||||
var sourcemaps = require('./source-map-support');
|
||||
sourcemaps(compiler);
|
||||
|
||||
var code = compiler.compile(node);
|
||||
compiler.applySourceMaps();
|
||||
|
||||
var map = options.sourcemap === 'generator'
|
||||
? compiler.map
|
||||
: compiler.map.toJSON();
|
||||
|
||||
return { code: code, map: map };
|
||||
}
|
||||
|
||||
var code = compiler.compile(node);
|
||||
return code;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue