lib/polymerize.js
function parseSource(src, filepath) {
  var result  = {};

  // Use whacko (cheerio) to parse html source
  var $       = whacko.load(src);

  // Extract sources and remove tags
  result.imports = extractImports($);
  result.scripts = extractScripts($);
  result.inline  = extractInline($)

  // Inline external stylesheets
  inlineStylesheet($, filepath)

  // Inline css minification and remove comments
  minifyHtml($)

  // Extract transformed html source:
  result.head = $("head").html().trim();
  result.body = $("body").html().trim();

  return result;
}
function parseSource(src, filepath) {
  var result  = {};

  // Use whacko (cheerio) to parse html source
  var $       = whacko.load(src);

  // Extract sources and remove tags
  result.imports = extractImports($);
  result.scripts = extractScripts($);
  result.inline  = extractInline($)

  // Inline external stylesheets
  inlineStylesheet($, filepath)

  // Inline css minification and remove comments
  minifyHtml($)

  // Extract transformed html source:
  result.head = $("head").html().trim();
  result.body = $("body").html().trim();

  return result;
}
function parseSource ( src , filepath ) { var result = { } ; // Use whacko (cheerio) to parse html source var $ = whacko . load ( src ) ; // Extract sources and remove tags result . imports = extractImports ( $ ) ; result . scripts = extractScripts ( $ ) ; result . inline = extractInline ( $ ) // Inline external stylesheets inlineStylesheet ( $ , filepath ) // Inline css minification and remove comments minifyHtml ( $ ) // Extract transformed html source: result . head = $ ( "head" ) . html ( ) . trim ( ) ; result . body = $ ( "body" ) . html ( ) . trim ( ) ; return result ; }
Parse a polymer component and return a parse result object

@param {String} src
Web-component html source

@param {String} filepath
Web-component filepath

@return {Object}
Parse result object:
- `imports` {Array}: Relative path to other components to require as commonjs module
- `scripts` {Array}: Relative path to other javascript modules
- `inline` {Array}: Inline script sources
- `head` {String}: Source to insert into the main document's head
- `body` {String}: Source to insert into the document's body
Parse a polymer component and return a parse result object