-
Notifications
You must be signed in to change notification settings - Fork 9
Distribute Grunt Workflow #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /* scopeQuerySelectorShim.js | ||
| * | ||
| * Copyright (C) 2015 Larry Davis | ||
| * All rights reserved. | ||
| * | ||
| * This software may be modified and distributed under the terms | ||
| * of the BSD license. See the LICENSE file for details. | ||
| */ | ||
| (function() { | ||
| if (!HTMLElement.prototype.querySelectorAll) { | ||
| throw new Error("rootedQuerySelectorAll: This polyfill can only be used with browsers that support querySelectorAll"); | ||
| } | ||
| // A temporary element to query against for elements not currently in the DOM | ||
| // We'll also use this element to test for :scope support | ||
| var container = document.createElement("div"); | ||
| // Check if the browser supports :scope | ||
| try { | ||
| // Browser supports :scope, do nothing | ||
| container.querySelectorAll(":scope *"); | ||
| } catch (e) { | ||
| // Match usage of scope | ||
| var scopeRE = /^\s*:scope/gi; | ||
| // Overrides | ||
| function overrideNodeMethod(prototype, methodName) { | ||
| // Store the old method for use later | ||
| var oldMethod = prototype[methodName]; | ||
| // Override the method | ||
| prototype[methodName] = function(query) { | ||
| var nodeList, gaveId = false, gaveContainer = false; | ||
| if (query.match(scopeRE)) { | ||
| // Remove :scope | ||
| query = query.replace(scopeRE, ""); | ||
| if (!this.parentNode) { | ||
| // Add to temporary container | ||
| container.appendChild(this); | ||
| gaveContainer = true; | ||
| } | ||
| parentNode = this.parentNode; | ||
| if (!this.id) { | ||
| // Give temporary ID | ||
| this.id = "rootedQuerySelector_id_" + new Date().getTime(); | ||
| gaveId = true; | ||
| } | ||
| // Find elements against parent node | ||
| nodeList = oldMethod.call(parentNode, "#" + this.id + " " + query); | ||
| // Reset the ID | ||
| if (gaveId) { | ||
| this.id = ""; | ||
| } | ||
| // Remove from temporary container | ||
| if (gaveContainer) { | ||
| container.removeChild(this); | ||
| } | ||
| return nodeList; | ||
| } else { | ||
| // No immediate child selector used | ||
| return oldMethod.call(this, query); | ||
| } | ||
| }; | ||
| } | ||
| // Browser doesn't support :scope, add polyfill | ||
| overrideNodeMethod(HTMLElement.prototype, "querySelector"); | ||
| overrideNodeMethod(HTMLElement.prototype, "querySelectorAll"); | ||
| } | ||
| })(); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| /* scopeQuerySelectorShim.js | ||
| * | ||
| * Copyright (C) 2015 Larry Davis | ||
| * All rights reserved. | ||
| * | ||
| * This software may be modified and distributed under the terms | ||
| * of the BSD license. See the LICENSE file for details. | ||
| */ | ||
| !function(){function a(a,c){var e=a[c];a[c]=function(a){var c,f=!1,g=!1;return a.match(d)?(a=a.replace(d,""),this.parentNode||(b.appendChild(this),g=!0),parentNode=this.parentNode,this.id||(this.id="rootedQuerySelector_id_"+(new Date).getTime(),f=!0),c=e.call(parentNode,"#"+this.id+" "+a),f&&(this.id=""),g&&b.removeChild(this),c):e.call(this,a)}}if(!HTMLElement.prototype.querySelectorAll)throw new Error("rootedQuerySelectorAll: This polyfill can only be used with browsers that support querySelectorAll");var b=document.createElement("div");try{b.querySelectorAll(":scope *")}catch(c){var d=/^\s*:scope/gi;a(HTMLElement.prototype,"querySelector"),a(HTMLElement.prototype,"querySelectorAll")}}(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of committing built files to the repo, it makes diffs for PRs ugly and bloats the history.
I haven't done enough with bower to know if it's simple to do, but is there a way we can only run the build when we're publishing and not commit the output to master, maybe in a separate branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally bower packages have a dist folder idea being everything else is ignored and just that is fetched. If people want to fetch everything, or the src folder too, then they use bower
exportsOverrideto define what gets pulled.I've never heard of anyone using a separate branch for releases. That seems to be what tags are for...
As far as PRs, you can ignore anything in the diffs directory. Remember those are slave files. Even if there is a conflict on a dist file, Just make sure the source files look ok, merge them if needed, and rebuild.
I guess you could say a src/dest workflow "bloats the history", but is the current method of serving un-minified assets not a bloat on bandwidth? The minified file is 33% smaller.
Aside from optimization, this workflow is proposed so that the repo observes it's own license. Note that the files in the dist/ directory have the required credits.