Collect all CSS definitions
547616
def pisaPreLoop(node, context, collect=False):
    

    data = u""
    if node.nodeType == Node.TEXT_NODE and collect:
        data = node.data

    elif node.nodeType == Node.ELEMENT_NODE:
        name = node.tagName.lower()

        if name in ("style", "link"):
            attr = pisaGetAttributes(context, name, node.attributes)
            media = [x.strip()
                     for x in attr.media.lower().split(",") if x.strip()]

            if attr.get("type", "").lower() in ("", "text/css") and \
                    (not media or "all" in media or "print" in media or "pdf" in media):

                if name == "style":
                    for node in node.childNodes:
                        data += pisaPreLoop(node, context, collect=True)
                    context.addCSS(data)
                    return u""

                if name == "link" and attr.href and attr.rel.lower() == "stylesheet":
                    # print "CSS LINK", attr
                    context.addCSS('\n@import "%s" %s;' %
                                   (attr.href, ",".join(media)))

    for node in node.childNodes:
        result = pisaPreLoop(node, context, collect=collect)
        if collect:
            data += result

    return data
895816
def get_style_defs(self, arg=None):
        
        if arg is None:
            arg = ('cssclass' in self.options and '.'+self.cssclass or '')
        if isinstance(arg, string_types):
            args = [arg]
        else:
            args = list(arg)

        def prefix(cls):
            if cls:
                cls = '.' + cls
            tmp = []
            for arg in args:
                tmp.append((arg and arg + ' ' or '') + cls)
            return ', '.join(tmp)

        styles = [(level, ttype, cls, style)
                  for cls, (style, ttype, level) in iteritems(self.class2style)
                  if cls and style]
        styles.sort()
        lines = ['%s { %s } /* %s */' % (prefix(cls), style, repr(ttype)[6:])
                 for (level, ttype, cls, style) in styles]
        if arg and not self.nobackground and \
           self.style.background_color is not None:
            text_style = ''
            if Text in self.ttype2class:
                text_style = ' ' + self.class2style[self.ttype2class[Text]][0]
            lines.insert(0, '%s { background: %s;%s }' %
                         (prefix(''), self.style.background_color, text_style))
        if self.style.highlight_color is not None:
            lines.insert(0, '%s.hll { background-color: %s }' %
                         (prefix(''), self.style.highlight_color))
        return '\n'.join(lines)
673350
function css() {
				const cssElement = findChild(libraryAppData, "css");
				if ( cssElement != null ) {
					const css = cssElement._;
					if ( css === "false" ) {
						log.verbose("  sap.ui5/library/css property taken from .library appData: '%s'", false);
						return false;
					}
				} else if ( libraryJSInfo.noLibraryCSS ) {
					log.verbose("  sap.ui5/library/css property extracted from library.js: '%s'", false);
					return false;
				}
			}
867828
function load() {
        Inspector.Page.on("frameNavigated.CSSAgent", _onFrameNavigated);
        Inspector.CSS.on("styleSheetAdded.CSSAgent", _styleSheetAdded);
        Inspector.CSS.on("styleSheetRemoved.CSSAgent", _styleSheetRemoved);

        // getAllStyleSheets was deleted beginning with Chrome 34
        if (!_getAllStyleSheetsNotFound) {
            Inspector.Page.on("frameStoppedLoading.CSSAgent", _onFrameStoppedLoading);
        }
    }
1146168
function css () {
  b.css('substance.css', DIST + 'substance.css', { variables: true })
  b.css('substance.css', DIST + 'substance.next.css')
  b.css('substance-pagestyle.css', DIST + 'substance-pagestyle.css', {variables: true})
  b.css('substance-pagestyle.css', DIST + 'substance-pagestyle.next.css')
  b.css('substance-reset.css', DIST + 'substance-reset.css', {variables: true})
  b.css('substance-reset.css', DIST + 'substance-reset.next.css')
}
351512
function generateStylesheets(done) {
			// Convert codepoints to array of strings
			var codepoints = [];
			_.each(o.glyphs, function(name) {
				codepoints.push(o.codepoints[name].toString(16));
			});
			o.codepoints = codepoints;

			// Prepage glyph names to use as CSS classes
			o.glyphs = _.map(o.glyphs, classnameize);

			o.stylesheets.sort(function(a, b) {
				return a === 'css' ? 1 : -1;
			}).forEach(generateStylesheet);

			done();
		}
760200
def _lookup_style(element, names):
    '''
    
    '''
    return _STYLES.get('_'+element, '') + \
        ''.join([_STYLES.get(name, '') for name in names])
1202462
function queryImport(styles) {
    if (styles.indexOf('@import') < 0) return []
    const arr = []
    const ast = csstree.parse(styles);
    csstree.walk(ast, {
        enter: function (node) {
            if (node.type === 'Atrule' && node.name === 'import') {
                const pat = node.prelude.children.head.data.value
                arr.push(pat.substring(1, pat.length - 1))
            }
        }
    })
    return arr
}
459706
def css_files(self):
        ''' 

        '''
        bokehjsdir = self.bokehjsdir()
        js_files = []
        for root, dirnames, files in os.walk(bokehjsdir):
            for fname in files:
                if fname.endswith(".css"):
                    js_files.append(join(root, fname))
        return js_files
902460
function extractStyleUrls(resolver, baseUrl, cssText) {
	      var foundUrls = [];
	      var modifiedCssText = cssText.replace(_cssImportRe, function () {
	          var m = [];
	          for (var _i = 0; _i < arguments.length; _i++) {
	              m[_i - 0] = arguments[_i];
	          }
	          var url = m[1] || m[2];
	          if (!isStyleUrlResolvable(url)) {
	              // Do not attempt to resolve non-package absolute URLs with URI scheme
	              return m[0];
	          }
	          foundUrls.push(resolver.resolve(baseUrl, url));
	          return '';
	      });
	      return new StyleWithImports(modifiedCssText, foundUrls);
	  }
366826
function() {

		var result_styles = [],
			name,
			value;

		for (name in this._static_styles) {

			result_styles.push(name + ':' + this._static_styles[name]);

		}

		for (name in this._style_bindings) {

			value = this._style_bindings[name].getValue();
			if (value != null) {
				result_styles.push(name + ':' + value.toString().trim());
			}

		}

		value = result_styles.join(';');

		if (Lava.schema.view.VALIDATE_STYLES) {
			this.assertStyleValid(value);
		}

		return value;

	}
1172368
def dumb_css_parser(data):
    """"""
    # remove @import sentences
    data += ';'
    importIndex = data.find('@import')
    while importIndex != -1:
        data = data[0:importIndex] + data[data.find(';', importIndex) + 1:]
        importIndex = data.find('@import')

    # parse the css. reverted from dictionary compehension in order to support older pythons
    elements =  [x.split('{') for x in data.split('}') if '{' in x.strip()]
    try:
        elements = dict([(a.strip(), dumb_property_dict(b)) for a, b in elements])
    except ValueError:
        elements = {} # not that important

    return elements
1001504
function toCssModule(styles) {
    var done = false;
    var res;

    new modules().load(styles, prefix + uni()).then(function(next) {
      done = true;
      res = next;
    });

    deasync.loopWhile(function() {
      return !done;
    });

    return res;
  }
500230
function( css ) {
			css = [].concat( css );
			var item,
				retval = [];
			for ( var i = 0; i < css.length; i++ ) {
				if ( ( item = css[ i ] ) ) {
					// Is CSS style text ?
					if ( /@import|[{}]/.test( item ) )
						retval.push( '<style>' + item + '</style>' );
					else
						retval.push( '<link type="text/css" rel=stylesheet href="' + item + '">' );
				}
			}
			return retval.join( '' );
		}
963910
function(css) {
  css = css
    // remove comments
    .replace(/\/\*[^\0]*?\*\//g, '')
    // trim space before characters
    .replace(/\s+({|})/g, '$1')
    // trim space after characters
    .replace(/(;|,|:|{|}|^)\s+/g, '$1')
    // trim combinators
    .replace(/\s+(>|\+|~)\s+/g, '$1')
    // remove escaped newlines and spaces
    .replace(/\\\r?\n\s+/g, '')
    // remove trailing semicolons in rules
    .replace(/;(})/g, '$1');

  return css;
}
1312587
function getStyles(props) {
  const { toolbar } = props.theme;

  return {
    container: [toolbar.container, props.style.container],
  };
}
335126
function extractImages(css, options) {
	var images = [];
	var stylesheetRelative = options.stylesheetRelative || path.dirname(css.source.input.file);

	if (!stylesheetRelative) {
		log(options.logLevel, 'lv1', ['Lazysprite:', colors.red('option `stylesheetRelative` is undefined!')]);
	}

	// When the css file is in the second or more depth level directory of destination
	// which relative to `stylesheetRelative`,
	// ref path in css will wrong, so has to be fix it.
	if (css.source.input.file) {
		var stylesheetInputDirRelative = path.relative(options.stylesheetInput, path.dirname(css.source.input.file));
		stylesheetRelative = path.join(stylesheetRelative, stylesheetInputDirRelative);
	}

	// Find @lazysprite string from css
	css.walkAtRules('lazysprite', function (atRule) {
		// Get the directory of images from atRule value
		var params = space(atRule.params);
		var atRuleValue = getAtRuleValue(params);
		var sliceDir = atRuleValue[0];

		// Get absolute path of directory.
		var imageDir = path.resolve(options.imagePath, sliceDir);

		// Check whether dir exist.
		if (!fs.existsSync(imageDir)) {
			log(options.logLevel, 'lv1', ['Lazysprite:', colors.red('No exist "' + imageDir + '"')]);
			return null;
		}

		// Get indent format of the css content.
		var atRuleNext = atRule.parent.nodes;
		var rawNode = _.find(atRuleNext, function (node) {
			return node.type === 'rule';
		});

		// Store the indent format.
		if (rawNode === undefined) {
			options.cloneRaws.between = '';
			options.cloneRaws.after = '';
		} else {
			options.cloneRaws.between = rawNode.raws.between;
			options.cloneRaws.after = rawNode.raws.after;
		}

		// Foreach the images and set image object.
		var files = fs.readdirSync(imageDir);
		files = _.orderBy(files); // Fix orders issue in mac and win's difference.
		_.forEach(files, function (filename) {
			// Have to be png or svg file
			var reg = /\.(png|svg)\b/i;
			if (!reg.test(filename)) {
				return null;
			}

			var image = {
				path: null, // Absolute path
				name: null, // Filename
				stylesheetRelative: stylesheetRelative,
				ratio: 1,
				groups: [],
				isSVG: false,
				token: ''
			};

			image.name = filename;

			// Set the directory name as sprite file name,
			// .pop() to get the last element in array
			image.dir = imageDir.split(path.sep).pop();
			image.groups = [image.dir];

			// For svg file
			if (/^\.svg/.test(path.extname(filename))) {
				image.isSVG = true;
				image.groups.push('GROUP_SVG_FLAG');
			}

			image.selector = setSelector(image, options, atRuleValue[1]);

			// Get absolute path of image
			image.path = path.resolve(imageDir, filename);

			// For retina
			if (isRetinaImage(image.name)) {
				image.ratio = getRetinaRatio(image.name);
				image.selector = setSelector(image, options, atRuleValue[1], true);
			}

			// Push image obj to array.
			images.push(image);
		});
	});
	return Promise.resolve([images, options]);
}