source: trip-planner-front/node_modules/stylus/lib/functions/current-media.js@ 59329aa

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

initial commit

  • Property mode set to 100644
File size: 506 bytes
Line 
1var nodes = require('../nodes');
2
3/**
4 * Returns the @media string for the current block
5 *
6 * @return {String}
7 * @api public
8 */
9
10module.exports = function currentMedia(){
11 var self = this;
12 return new nodes.String(lookForMedia(this.closestBlock.node) || '');
13
14 function lookForMedia(node){
15 if ('media' == node.nodeName) {
16 node.val = self.visit(node.val);
17 return node.toString();
18 } else if (node.block.parent.node) {
19 return lookForMedia(node.block.parent.node);
20 }
21 }
22};
Note: See TracBrowser for help on using the repository browser.