source: trip-planner-front/node_modules/css/lib/stringify/index.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 923 bytes
Line 
1
2/**
3 * Module dependencies.
4 */
5
6var Compressed = require('./compress');
7var Identity = require('./identity');
8
9/**
10 * Stringfy the given AST `node`.
11 *
12 * Options:
13 *
14 * - `compress` space-optimized output
15 * - `sourcemap` return an object with `.code` and `.map`
16 *
17 * @param {Object} node
18 * @param {Object} [options]
19 * @return {String}
20 * @api public
21 */
22
23module.exports = function(node, options){
24 options = options || {};
25
26 var compiler = options.compress
27 ? new Compressed(options)
28 : new Identity(options);
29
30 // source maps
31 if (options.sourcemap) {
32 var sourcemaps = require('./source-map-support');
33 sourcemaps(compiler);
34
35 var code = compiler.compile(node);
36 compiler.applySourceMaps();
37
38 var map = options.sourcemap === 'generator'
39 ? compiler.map
40 : compiler.map.toJSON();
41
42 return { code: code, map: map };
43 }
44
45 var code = compiler.compile(node);
46 return code;
47};
Note: See TracBrowser for help on using the repository browser.