Skip to content

Instantly share code, notes, and snippets.

Created August 11, 2014 23:54
Show Gist options
  • Save anonymous/d682e9f908804f30f056 to your computer and use it in GitHub Desktop.
Save anonymous/d682e9f908804f30f056 to your computer and use it in GitHub Desktop.
fetchDependencies: (version, value) ->
deferred = $q
for x in version.dependencies
@searchTerm(x.name).then (data) =>
d = _.first(data)
dep_search = _.last(d.versions)
if dep_search.scripts.length > 0
el = document.createElement("script")
el.setAttribute("data-require", value.name + "@*")
el.setAttribute("data-semver", version.semver)
el.setAttribute("src", version.scripts)
return el
console.log @arr, 'script'
else if dep_search.styles.length > 0
el = document.createElement("styles")
el.setAttribute("data-require", value.name + "@~" + version.semver)
el.setAttribute("data-semver", version.semver)
el.setAttribute("src", version.styles)
return el
$q.all(@arr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment