Merge branch 'devel' into npm-cordova-docs

This commit is contained in:
Sashko Stubailo
2014-09-10 15:33:10 -07:00
5 changed files with 47 additions and 23 deletions

View File

@@ -107,13 +107,13 @@ Autoupdate._retrySubscription = function () {
}
};
var attachStylesheetLink = function (newLink) {
var removeOldLinks = _.after(newCss.length, function () {
_.each(oldLinks, function (oldLink) {
oldLink.parentNode.removeChild(oldLink);
});
var removeOldLinks = _.after(newCss.length, function () {
_.each(oldLinks, function (oldLink) {
oldLink.parentNode.removeChild(oldLink);
});
});
var attachStylesheetLink = function (newLink) {
document.getElementsByTagName("head").item(0).appendChild(newLink);
waitUntilCssLoads(newLink, function () {
@@ -121,14 +121,19 @@ Autoupdate._retrySubscription = function () {
});
};
_.each(newCss, function (css) {
var newLink = document.createElement("link");
newLink.setAttribute("rel", "stylesheet");
newLink.setAttribute("type", "text/css");
newLink.setAttribute("class", "__meteor-css__");
newLink.setAttribute("href", css.url);
attachStylesheetLink(newLink);
});
if (newCss.length !== 0) {
_.each(newCss, function (css) {
var newLink = document.createElement("link");
newLink.setAttribute("rel", "stylesheet");
newLink.setAttribute("type", "text/css");
newLink.setAttribute("class", "__meteor-css__");
newLink.setAttribute("href", css.url);
attachStylesheetLink(newLink);
});
} else {
removeOldLinks();
}
}
else if (doc._id === 'version' && doc.version !== autoupdateVersion) {
handle && handle.stop();

View File

@@ -12,7 +12,7 @@
/**
* Get a tag dictionary from the tags field on the object, for custom fields
* like package
* @param {JSDoc object} data The thing you get in the TaffyDB from JSDoc
* @param {JSDocData} data The thing you get in the TaffyDB from JSDoc
* @return {Object} Keys are the parameter names, values are the values.
*/
var getTagDict = function (data) {

View File

@@ -5,10 +5,15 @@ cd $(dirname $0)
cd ../../..
TOPDIR=$(pwd)
INFINITY=10000
cd $TOPDIR
${TOPDIR}/dev_bundle/bin/node \
# Call git grep to find all js files with the appropriate comment tags,
# and only then pass it to JSDoc which will parse the JS files.
# This is a whole lot faster than calling JSDoc recursively.
git grep -al "@summary" | xargs -L ${INFINITY} -t \
${TOPDIR}/dev_bundle/bin/node \
${TOPDIR}/dev_bundle/lib/node_modules/.bin/jsdoc \
-t "${TOPDIR}/scripts/admin/jsdoc/docdata-jsdoc-template" \
-c "${TOPDIR}/scripts/admin/jsdoc/jsdoc-conf.json" \
-r "${TOPDIR}/packages" "${TOPDIR}/tools"
-c "${TOPDIR}/scripts/admin/jsdoc/jsdoc-conf.json"

View File

@@ -837,6 +837,9 @@ _.extend(ClientTarget.prototype, {
// Overwrite the CSS files list with the new concatenated file
var stringifiedCss = CssTools.stringifyCss(self._cssAstCache,
{ sourcemap: true });
if (! stringifiedCss.code)
return;
self.css = [new File({ data: new Buffer(stringifiedCss.code, 'utf8') })];
// Add the contents of the input files to the source map of the new file
@@ -884,9 +887,10 @@ _.extend(ClientTarget.prototype, {
minifiedCss = minifiers.CssTools.minifyCss(allCss);
}
self.css = [new File({ data: new Buffer(minifiedCss, 'utf8') })];
self.css[0].setUrlToHash(".css", "?meteor_css_resource=true");
if (!! minifiedCss) {
self.css = [new File({ data: new Buffer(minifiedCss, 'utf8') })];
self.css[0].setUrlToHash(".css", "?meteor_css_resource=true");
}
},
// Output the finished target to disk

View File

@@ -3,10 +3,20 @@ if (Meteor.isClient) {
return $(document.body).css('background-color');
};
var linkHref = function () {
var links = document.getElementsByTagName('link');
if (links.length > 0) {
return links[0].href;
} else {
return null;
}
}
Meteor.startup(function () {
Meteor.call("clientLoad");
var numCssChanges = 0;
var oldBackgroundColor = backgroundColor();
var oldLinkHref = linkHref();
Meteor.call("newStylesheet", numCssChanges, oldBackgroundColor);
var waitingForCssReloadToComplete = false;
Meteor.setInterval(function () {
@@ -19,10 +29,10 @@ if (Meteor.isClient) {
// give the client some time to load the new css
var handle = Meteor.setInterval(function () {
var numberLinks = document.getElementsByTagName('link').length;
if (numberLinks === 1) {
// numberLinks will be 1 once the old css link is removed.
var newLinkHref = linkHref();
if (newLinkHref !== oldLinkHref) {
oldBackgroundColor = backgroundColor();
oldLinkHref = newLinkHref;
Meteor.call("newStylesheet", ++numCssChanges, oldBackgroundColor);
waitingForCssReloadToComplete = false;
Meteor.clearInterval(handle);