rip of broccoli-postcss
511156
function PostcssCompiler(inputTrees, inputFile, outputFile, plugins, map, useSass, includePaths) {
	if (!(this instanceof PostcssCompiler)) {
		return new PostcssCompiler(inputTrees, inputFile, outputFile, plugins, map);
	}

	if (!Array.isArray(inputTrees)) {
		throw new Error('Expected array for first argument - did you mean [tree] instead of tree?');
	}

	CachingWriter.call(this, inputTrees, inputFile);

	this.inputFile = inputFile;
	this.outputFile = outputFile;
	this.plugins = plugins || [];
	this.map = map || {};
	this.warningStream = process.stderr;
    this.useSass = useSass || false;
	this.includePaths = includePaths || [];
}
956800
function readCSSFile(files = []) {

		if (OPTIONS.verbose) { console.log(info('Input - CSS File : ' + files[readCSSFileCount])); }

		if (validUrl.isUri(files[readCSSFileCount])) {
			request({
				url: files[readCSSFileCount],
				method: "GET"
			}, function(err, headRes, body) {
				if (headRes !== undefined) {
					var size = headRes.headers['content-length'];
					
					if (size == undefined || size == 0) {
						filesizeKB = kiloByteLength(body);
					} else {
						filesizeKB = size/1000;	
					}
				} else {
					var size = kiloByteLength(body);
					filesizeKB = size/1000;
				}

				
				stats.files.css.push({
					"filename" : files[readCSSFileCount],
					"filesizeKB" : filesizeKB
				});
				stats.before.totalFileSizeKB += filesizeKB;

			});
		} else {
			filesizeKB = getFilesizeInKiloBytes(files[readCSSFileCount]);

			stats.files.css.push({
				"filename" : files[readCSSFileCount],
				"filesizeKB" : filesizeKB
			});
			stats.before.totalFileSizeKB += filesizeKB;
		}


		summary.files.input.push(files[readCSSFileCount]);


		if (validUrl.isUri(files[readCSSFileCount])) {
			
		  request(files[readCSSFileCount], function (err, response, body) {

		  	if (response === undefined) {

		  		//try again
		  		request(files[readCSSFileCount], function (err, response, body) {

		  			if (response.statusCode == 200) {
				    	dataCSSIn.push(body);

				    	readCSSFileCount += 1;

							if (readCSSFileCount < files.length) {

								CPEVENTS.emit('CSS_READ_AGAIN');	
							} else {

								CPEVENTS.emit('CSS_READ_END');
							}

				    } else {
							CPEVENTS.emit('CSS_READ_ERROR');
							console.log(error("CSS File read error: check your CSS files and please try again."));
							console.log(err)
							process.exit(1);
				    }

		  		});


		  	} else if (response.statusCode == 200) {
		    	dataCSSIn.push(body);

		    	readCSSFileCount += 1;

					if (readCSSFileCount < files.length) {

						CPEVENTS.emit('CSS_READ_AGAIN');	
					} else {

						CPEVENTS.emit('CSS_READ_END');
					}

		    } else {
					CPEVENTS.emit('CSS_READ_ERROR');
					console.log(error("CSS File read error: check your CSS files and please try again."));
					console.log(err)
					process.exit(1);
		    }
			});

		} else {


			readStream = fs.createReadStream(files[readCSSFileCount], 'utf8');

			readStream.on('data', function(chunk) { 
				dataCSSIn.push(chunk);

			}).on('end', function() {
				readCSSFileCount += 1;
				if (readCSSFileCount < files.length) {

					CPEVENTS.emit('CSS_READ_AGAIN');	
				} else {
					CPEVENTS.emit('CSS_READ_END');
				}
				
			}).on('error', function(e) {
				CPEVENTS.emit('CSS_READ_ERROR');
				console.log(error("CSS File read error: Something went wrong while reading the file(s), check your CSS files and please try again."));
				console.log(e);
				process.exit(1);
			});

		} //end of url check
	}
113570
function loadCss(url) {
                if (this.context._cssReady.indexOf(url) === -1) {
                    this.context._cssReady.push(url);
                    var linkRef = document.createElement("link");
                    linkRef.setAttribute("rel", "stylesheet");
                    linkRef.setAttribute("type", "text/css");
                    linkRef.setAttribute("href", url);
                    if (typeof linkRef != "undefined") {
                        document.getElementsByTagName("head")[0].appendChild(linkRef);
                    }
                }
            }
498278
private void showErrorPage(HttpServletResponse resp, String message) throws IOException {
		resp.setStatus(HttpServletResponse.SC_OK);
		resp.setContentType(GUIServletStub.CONTENT_TYPE_HTML);

		PrintWriter writer = resp.getWriter();

		writer
			.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
		writer.println("<html>");
		writer.println("<head>");
		writer.println("  <title>Launch Job - Error</title>");
		writer.println("  <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />");
		writer.println("  <link rel=\"stylesheet\" type=\"text/css\" href=\"css/nephelefrontend.css\" />");
		writer.println("</head>");

		writer.println("<body>");
		writer.println("  <div class=\"mainHeading\">");
		writer
			.println("    <h1><img src=\"img/StratosphereLogo.png\" width=\"326\" height=\"100\" alt=\"Stratosphere Logo\" align=\"middle\"/>Nephele and PACTs Query Interface</h1>");
		writer.println("  </div>");
		writer.println("  <div style=\"margin-top: 50px; text-align: center;\">");
		writer.println("    <p class=\"error_text\" style=\"font-size: 18px;\">");
		writer.println(message);
		writer.println("    </p><br/><br/>");
		writer.println("    <form action=\"launch.html\" method=\"GET\">");
		writer.println("      <input type=\"submit\" value=\"back\">");
		writer.println("    </form>");
		writer.println("  </div>");
		writer.println("</body>");
		writer.println("</html>");
	}
38280
protected void appendCssNode(HttpServletRequest request, Document document, DocumentFragment head, Css css, String relativeRoot) {
        final String stylePath = getElementPath(request, css, relativeRoot);

        if (resourcesDao.isConditional(css)) {
            Comment c = document.createComment("");
            c.appendData(OPEN_COND_COMMENT_PRE);
            c.appendData(css.getConditional());
            c.appendData(OPEN_COND_COMMENT_POST);
            c.appendData(OPEN_STYLE);
            c.appendData(stylePath);
            if (StringUtils.isNotBlank(css.getMedia())) {
                c.appendData("\" media=\"");
                c.appendData(css.getMedia());
            }
            c.appendData(CLOSE_STYLE);
            c.appendData(CLOSE_COND_COMMENT);
            head.appendChild(c);
        }
        else {
            Element element = document.createElement(LINK);
            element.setAttribute(REL, "stylesheet");
            element.setAttribute(TYPE, "text/css");
            element.setAttribute(HREF, stylePath);
            if (StringUtils.isNotBlank(css.getMedia())) {
                element.setAttribute(MEDIA, css.getMedia());
            }
            head.appendChild(element);
        }
    }
438150
function cleanup(html) {
      html = cheerio.load(html);
      html('[' + ignoreAttr + ']').removeAttr(ignoreAttr);
      html = html.html();
      return html;
    }
428237
function cssPoll() {
        for (var url in monitors) {
            var callbackObj = monitors[url],
                node = callbackObj.node;
            if (isCssLoaded(node, url)) {
                if (callbackObj.callback) {
                    callbackObj.callback.call(node);
                }
                delete monitors[url];
            }
        }

        if (Utils.isEmptyObject(monitors)) {
            logger.debug('clear css poll timer');
            timer = 0;
        } else {
            timer = setTimeout(cssPoll, CSS_POLL_INTERVAL);
        }
    }
159586
function bg_w_grad($el, url){
  var c = '230,230,230';//'231,229,224';
  var s = 'linear-gradient(-90deg, rgba('+c+',1) 10%, rgba('+c+',.55) 70%, rgba('+c+',0) 90%, rgba('+c+',0) 100%)';
  $el.css({'background-image': vendor_prefix.css+s+'', 'background-repeat':'no-repeat'}); //, url('+url+')
}
1304121
function (context) {
		var file = context.file;

		try {
			file.data = cleanCSS.process(file.data);
		} catch (err) {
			context.error('CSS syntax error: "%s"',
				file.pathname);
		}
	}
719012
@Override
	protected StringBuffer doPostProcessBundle(BundleProcessingStatus status, StringBuffer bundleData)
			throws IOException {

		String data = bundleData.toString();

		// Rewrite each css url path
		Matcher matcher = IMPORT_PATTERN.matcher(data);
		StringBuffer sb = new StringBuffer();
		while (matcher.find()) {

			String content = getCssPathContent(matcher.group(3), matcher.group(4), status);
			matcher.appendReplacement(sb, RegexUtil.adaptReplacementToMatcher(content));
		}
		matcher.appendTail(sb);
		return sb;

	}
859517
def _post_tidy(html):
    
    tree = etree.fromstring(html)
    ems = tree.xpath(
        "//xh:em[@class='underline']|//xh:em[contains(@class, ' underline ')]",
        namespaces={'xh': 'http://www.w3.org/1999/xhtml'})
    for el in ems:
        c = el.attrib.get('class', '').split()
        c.remove('underline')
        el.tag = '{http://www.w3.org/1999/xhtml}u'
        if c:
            el.attrib['class'] = ' '.join(c)
        elif 'class' in el.attrib:
            del(el.attrib['class'])

    return tree
849592
def _bake_css(link):
    
    if "href" in link.attrs and (re.search("\.css$", link["href"])) or ("rel" in link.attrs and link["rel"] is "stylesheet") or ("type" in link.attrs and link["type"] is "text/css"):
        if re.match("https?://", link["href"]):
            css_data = _load_url(link["href"]).read()
        else:
            css_data = _load_file(link["href"]).read()
        link.clear()
        if USING_PYTHON2:
            link.string = css_data
        else:
            link.string = str(css_data)
        link.name = "style"
        del link["rel"]
        del link["href"]
595818
function postProcessList( list )
	{
		var children = list.children,
			child,
			attrs,
			count = list.children.length,
			match,
			mergeStyle,
			styleTypeRegexp = /list-style-type:(.*?)(?:;|$)/,
			stylesFilter = CKEDITOR.plugins.pastefromword.filters.stylesFilter;

		attrs = list.attributes;
		if ( styleTypeRegexp.exec( attrs.style ) )
			return;

		for ( var i = 0; i < count; i++ )
		{
			child = children[ i ];

			if ( child.attributes.value && Number( child.attributes.value ) == i + 1 )
				delete child.attributes.value;

			match = styleTypeRegexp.exec( child.attributes.style );

			if ( match )
			{
				if ( match[ 1 ] == mergeStyle || !mergeStyle )
					mergeStyle = match[ 1 ];
				else
				{
					mergeStyle = null;
					break;
				}
			}
		}

		if ( mergeStyle )
		{
			for ( i = 0; i < count; i++ )
			{
				attrs = children[ i ].attributes;
				attrs.style && ( attrs.style = stylesFilter( [ [ 'list-style-type'] ] )( attrs.style ) || '' );
			}

			list.addStyle( 'list-style-type', mergeStyle );
		}
	}
1366872
function processCSS(state, minify, file) {
        /* jshint quotmark: false */
        var css = fs.readFileSync(file).toString(),
            js;
        state.css.push(css);
        
        if (minify) {
            css = css
        .replace(/\r?\n/g, '')
        .replace(/\/\*.*?\*\//g, '')
        .replace(/:\s+/g, ':')
        .replace(/\s*\{\s*/g, '{')
        .replace(/\s*\}\s*/g, '}')
        .replace(/\s*\,\s*/g, ',')
        .replace(/\s*\;\s*/g, ';');
        }
        //escape for js
        css = css
      .replace(/\\/g, '\\\\')
      .replace(/'/g, "\\'")
      .replace(/\r?\n/g, '\\n');
        js = "!angular.$$csp() && angular.element(document).find('head').prepend('<style type=\"text/css\">" + css + "</style>');";
        state.js.push(js);
        
        return state;
    }
1241904
function(pathname, css, req, next) {
          if (!self.options.bless) {
            fs.writeFileSync(pathname, css);
            return next();
          }
          self.splitWithBless(pathname, css);
          return next();
        }
1362295
protected String postcss(HttpServletRequest request, String css, IResource res) throws IOException {
		if (threadScopes == null) {
			return css;
		}
		Context cx = Context.enter();
		Scriptable threadScope = null;
		String result = null;
		try {
			threadScope = threadScopes.poll(SCOPE_POOL_TIMEOUT_SECONDS, TimeUnit.SECONDS);
			if (threadScope == null) {
				throw new TimeoutException("Timeout waiting for thread scope"); //$NON-NLS-1$
			}
			Scriptable scope = cx.newObject(threadScope);
			scope.setParentScope(threadScope);
			Scriptable postcssInstance = (Scriptable)threadScope.get(POSTCSS_INSTANCE, scope);
			Function postcssProcessor = (Function)postcssInstance.getPrototype().get(PROCESS, postcssInstance);
			Object processed = postcssProcessor.call(cx, scope, postcssInstance, new Object[]{css, postcssOptions});
			result = Context.toString(processed);
		} catch (JavaScriptException e) {
			// Add module info
			String message = "Error parsing " + res.getURI() + "\r\n" + e.getMessage(); //$NON-NLS-1$ //$NON-NLS-2$
			throw new IOException(message, e);
		} catch (InterruptedException e) {
			throw new RuntimeException(e);
		} catch (TimeoutException e) {
			throw new RuntimeException(e);
		}
		finally {
			if (threadScope != null) {
				// put the thread scope back in the queue now that we're done with it
				threadScopes.add(threadScope);
			}
			Context.exit();
		}
		return result;
	}
144822
public function _amp_post_template_css() {
		ob_start();
		$this->_print_front_styles();
		$css = ob_get_clean();
		$css = str_replace( '!important', '', $css );
		// @codingStandardsIgnoreStart
		echo $css;
		// @codingStandardsIgnoreEnd
	}