Skip to content
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

Minify cross-domain resources #279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,32 @@ module.exports = function(grunt) {
files: {
'dest/respond.matchmedia.addListener.min.js': ['src/matchmedia.polyfill.js', 'src/matchmedia.addListener.js', 'src/respond.js']
}
},
crossDomain: {
options: {
preserveComments: 'some'
},
files: {
'dest/cross-domain/respond.proxy.min.js': ['cross-domain/respond.proxy.js']
}
}
},
htmlmin: {
crossDomain: {
options: {
collapseWhitespace: true,
conservativeCollapse: true,
minifyJS: true
},
files: {
'dest/cross-domain/respond-proxy.min.html': 'cross-domain/respond-proxy.html'
}
}
},
copy: {
crossDomain: {
src: 'cross-domain/respond.proxy.gif',
dest: 'dest/'
}
},
jshint: {
Expand Down Expand Up @@ -85,8 +111,10 @@ module.exports = function(grunt) {

grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-contrib-uglify' );
grunt.loadNpmTasks( 'grunt-contrib-htmlmin' );
grunt.loadNpmTasks( 'grunt-contrib-copy' );

// Default task.
grunt.registerTask('default', ['jshint', 'uglify']);
grunt.registerTask('default', ['jshint', 'uglify', 'htmlmin', 'copy']);

};
1 change: 1 addition & 0 deletions dest/cross-domain/respond-proxy.min.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- Respond.js: min/max-width media query polyfill. Remote proxy (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs --><!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Respond JS Proxy</title> </head> <body> <script>!function(){var t,n,e,o,r,c;o=function(){var t,n,e,o={};for(t=document.location.toString().split("?")[1].split("&"),n=0;n<t.length;n++)e=t[n].split("="),e[1]=decodeURIComponent(e[1].replace(/\+/g," ")),e[0].search(/\[\]/)>=0?(e[0]=e[0].replace("[]",""),"object"!=typeof o[e[0]]&&(o[e[0]]=[]),o[e[0]].push(e[1])):o[e[0]]=e[1];return o},r=function(t,n){var e=c();e&&(e.open("GET",t,!0),e.onreadystatechange=function(){4!=e.readyState||200!=e.status&&304!=e.status||n(e.responseText)},4!=e.readyState&&e.send())},c=function(){for(var t=!1,n=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new ActiveXObject("MSXML2.XMLHTTP.3.0")}],e=n.length;e--;){try{t=n[e]()}catch(o){continue}break}return function(){return t}}(),e=o(),n=e.css,t=e.url,n&&t&&r(n,function(n){window.name=n,window.location.href=t})}();</script></body></html>
Binary file added dest/cross-domain/respond.proxy.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions dest/cross-domain/respond.proxy.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 30 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
{
"name": "Respond.js",
"description": "min/max-width media query polyfill",
"name": "Respond.js",
"description": "min/max-width media query polyfill",
"version": "1.4.2",
"homepage": "https://github.com/scottjehl/Respond",
"homepage": "https://github.com/scottjehl/Respond",
"homepageShortened": "http://j.mp/respondjs",
"author": {
"name": "Scott Jehl",
"email": "[email protected]",
"url": "http://filamentgroup.com"
},
"repository": {
"type": "git",
"url": "https://github.com/scottjehl/Respond.git"
},
"bugs": {
"url": "https://github.com/scottjehl/Respond/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT"
}
],
"devDependencies": {
"grunt-cli":"~0.1",
"grunt": "~0.4.0",
"grunt-contrib-jshint": "~0.2.0",
"grunt-contrib-qunit": "~0.3.0",
"grunt-contrib-uglify": "0.2.7"
}

"author": {
"name": "Scott Jehl",
"email": "[email protected]",
"url": "http://filamentgroup.com"
},
"repository": {
"type": "git",
"url": "https://github.com/scottjehl/Respond.git"
},
"bugs": {
"url": "https://github.com/scottjehl/Respond/issues"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT"
}
],
"devDependencies": {
"grunt": "~0.4.0",
"grunt-cli": "~0.1",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-htmlmin": "^0.3.0",
"grunt-contrib-jshint": "~0.5.0",
"grunt-contrib-qunit": "~0.3.0",
"grunt-contrib-uglify": "0.2.7"
}
}