No files selected!
"; 147 | } else { 148 | loadInProgress = true; 149 | //fileList.innerHTML = ""; 150 | //var list = document.createElement("ul"); 151 | //fileList.appendChild(list); 152 | for (var i = 0; i < files.length; i++) { 153 | id++; 154 | var li = document.createElement("li"); 155 | var img = document.createElement("img"); 156 | var info = document.createElement("span"); 157 | var remove = document.createElement("div"); 158 | 159 | li.setAttribute('data-id', id); 160 | list.appendChild(li); 161 | 162 | img.src = window.URL.createObjectURL(files[i]); 163 | img.height = 60; 164 | img.onload = onload(id, files[i], files.length + blocks.length); 165 | li.appendChild(img); 166 | 167 | info.innerHTML = files[i].name.substring(0, files[i].name.indexOf('.')); 168 | li.appendChild(info); 169 | 170 | remove.classList.add('remove'); 171 | li.appendChild(remove); 172 | 173 | dropbox.classList.remove('is-empty'); 174 | } 175 | } 176 | fileElem.value = ''; 177 | } 178 | 179 | function loadComplete(){ 180 | var packer = new Packer(padding, prefix, path); 181 | packer.sort(blocks); 182 | packer.fit(blocks); 183 | packer.draw( 184 | blocks, 185 | canvas, 186 | css 187 | ); 188 | dimensionsElem.innerHTML = '(' + canvas.width + 'px by ' + canvas.height + 'px)'; 189 | loadInProgress = false; 190 | } 191 | 192 | function onload(id, file, queue){ 193 | return function(){ 194 | window.URL.revokeObjectURL(this.src); 195 | blocks.push({ 196 | w:this.naturalWidth, 197 | h:this.naturalHeight, 198 | img:this, 199 | name:file.name.substring(0, file.name.indexOf('.')), 200 | id:id 201 | }); 202 | loaded++; 203 | if(loaded === queue){ 204 | loadComplete(); 205 | } 206 | } 207 | } 208 | 209 | document.getElementById('download').addEventListener('click', function(){ 210 | var a = document.createElement('a'); 211 | a.href = canvas.toDataURL(); 212 | a.download = 'sprite.png'; 213 | document.body.appendChild(a); 214 | //console.log(a); 215 | a.click(); 216 | document.body.removeChild(a); 217 | 218 | ga('send', { 219 | hitType: 'event', 220 | eventCategory: 'Sprite Download', 221 | eventAction: 'click' 222 | }); 223 | 224 | }, false); 225 | 226 | var clipboard = new Clipboard('#copy'); 227 | 228 | document.getElementById('copy').addEventListener('click', function(){ 229 | ga('send', { 230 | hitType: 'event', 231 | eventCategory: 'Copy CSS', 232 | eventAction: 'click' 233 | }); 234 | }); -------------------------------------------------------------------------------- /assets/js/legacy/packer.js: -------------------------------------------------------------------------------- 1 | 2 | function Packer(pad, pre, path) { 3 | this.init(pad, pre, path) 4 | } 5 | 6 | Packer.prototype = { 7 | 8 | init: function (pad, pre, path) { 9 | var padding = isNumeric(pad) ? pad : 2; 10 | padding = Math.round(Math.abs(padding)); 11 | this.root = { 12 | x: 0, // origin x 13 | y: 0, // origin y 14 | w: 256 - padding, // width 15 | h: 256 - padding, // height 16 | p: padding 17 | }; 18 | this.prefix = pre; 19 | //this.prefix = this.prefix.replace(/ /g, ''); 20 | this.path = path; 21 | }, 22 | 23 | sort: function (blocks) { 24 | blocks.sort(function (a, b) { 25 | // should this be sorted by height? 26 | if (a.h < b.h) { 27 | return 1; 28 | } 29 | if (a.h > b.h) { 30 | return -1; 31 | } 32 | return 0; 33 | }); 34 | }, 35 | 36 | fit: function (blocks) { 37 | var n, node, block, p = this.root.p; 38 | for (n = 0; n < blocks.length; n++) { 39 | block = blocks[n]; 40 | block.fit = false; // reset 41 | if (node = this.findNode(this.root, block.w + p, block.h + p)) { 42 | block.fit = this.splitNode(node, block.w + p, block.h + p); 43 | } 44 | if(!block.fit){ 45 | this.resize(blocks); 46 | break; 47 | } 48 | } 49 | }, 50 | 51 | resize: function(blocks){ 52 | var w, h, p = this.root.p; 53 | if(this.root.w > this.root.h){ 54 | w = (this.root.w + p); 55 | h = (this.root.h + p) * 2; 56 | } else { 57 | w = (this.root.w + p) * 2; 58 | h = (this.root.h + p); 59 | } 60 | this.root = { 61 | x: 0, // origin x 62 | y: 0, // origin y 63 | w: w - p, // width 64 | h: h - p, // height 65 | p: p 66 | }; 67 | this.fit(blocks); 68 | }, 69 | 70 | findNode: function (root, w, h) { 71 | if (root.used) 72 | return this.findNode(root.right, w, h) || this.findNode(root.down, w, h); 73 | else if ((w <= root.w) && (h <= root.h)) 74 | return root; 75 | else 76 | return null; 77 | }, 78 | 79 | splitNode: function (node, w, h) { 80 | node.used = true; 81 | node.down = {x: node.x, y: node.y + h, w: node.w, h: node.h - h}; 82 | node.right = {x: node.x + w, y: node.y, w: node.w - w, h: h}; 83 | return node; 84 | }, 85 | 86 | draw: function (blocks, canvas, output) { 87 | var ctx = canvas.getContext('2d'); 88 | var gitubUrl = '/*\nResponsive CSS Sprite created using: ' + 89 | 'https://responsive-css.us/\n' + 90 | '*/\n\n'; 91 | var groupSelectors = ''; 92 | var globalStyle = '\n{display:inline-block; overflow:hidden; ' + 93 | 'background-repeat: no-repeat;\n' + 94 | 'background-image:url(' + this.path + ');}\n\n'; 95 | var spriteStyle = ''; 96 | var p = this.root.p; // padding 97 | var width = this.root.w + p; 98 | var height = this.root.h + p; 99 | var b; // block 100 | canvas.width = width; 101 | canvas.height = height; 102 | ctx.clearRect(0, 0, canvas.width, canvas.height); 103 | 104 | // sort blocks alphabetically 105 | blocks.sort(function(a,b){ 106 | var nameA = a.name.toUpperCase(); 107 | var nameB = b.name.toUpperCase(); 108 | return (nameA < nameB) ? -1 : (nameA > nameB) ? 1 : 0; 109 | }); 110 | 111 | for (var n = 0; n < blocks.length; n++) { 112 | b = blocks[n]; 113 | if (b.fit) { 114 | // turn on for testing 115 | // ctx.fillRect(b.fit.x + p, b.fit.y + p, b.w, b.h); 116 | // ctx.stroke(); 117 | ctx.drawImage(b.img, b.fit.x + p, b.fit.y + p); 118 | // add comma if not the last style 119 | groupSelectors += '.' + this.prefix + b.name + (n === blocks.length - 1 ? ' ' : ', '); 120 | // individual sprite style 121 | spriteStyle += '.' + this.prefix + b.name + 122 | ' {width:' + (b.w) + 'px; ' + 123 | 'height:' + (b.h) + 'px; ' + 124 | 'background-position:' + (((b.fit.x + p) / (width - (b.w))) * 100).toPrecision(6) + '% ' + 125 | (((b.fit.y + p) / (height - (b.h))) * 100).toPrecision(6) + '%; ' + 126 | 'background-size:' + ((width / (b.w)) * 100).toPrecision(6) + '%; ' + 127 | '}\n'; 128 | } 129 | } 130 | output.value = gitubUrl + groupSelectors + globalStyle + spriteStyle; 131 | } 132 | 133 | }; 134 | 135 | function isNumeric(n) { 136 | return !isNaN(parseFloat(n)) && isFinite(n); 137 | } 138 | 139 | module.exports = Packer; 140 | -------------------------------------------------------------------------------- /assets/styles/main.css: -------------------------------------------------------------------------------- 1 | html { 2 | -webkit-box-sizing: border-box; 3 | box-sizing: border-box; 4 | font-family: 'Roboto Condensed', sans-serif; 5 | color: #24292e; } 6 | 7 | *, *:before, *:after { 8 | -webkit-box-sizing: inherit; 9 | box-sizing: inherit; } 10 | 11 | html, body { 12 | height: 100%; } 13 | 14 | canvas { 15 | vertical-align: middle; } 16 | 17 | .page-wrap { 18 | padding-top: 120px; 19 | position: relative; 20 | height: 100%; } 21 | 22 | header { 23 | height: 120px; 24 | width: 100%; 25 | min-width: 1024px; 26 | background-color: #24292e; 27 | position: fixed; 28 | z-index: 3; 29 | padding: 8px 10px 0; } 30 | header h1 { 31 | font-size: 2em; 32 | margin: 0 0 2px; 33 | color: #ffffff; 34 | font-weight: normal; } 35 | header h2 { 36 | font-size: 0.85em; 37 | color: rgba(255, 255, 255, 0.75); 38 | font-weight: normal; 39 | margin: 0 0 15px; } 40 | header input { 41 | font-size: 1em; 42 | padding: 6px; 43 | font-family: 'Roboto Condensed', sans-serif; 44 | background-color: rgba(255, 255, 255, 0.125); 45 | color: #fff; 46 | border: none; 47 | border-radius: 2px; } 48 | header input:last-child { 49 | width: 30px; 50 | text-align: center; } 51 | header input.path-input { 52 | width: 400px; } 53 | header label { 54 | color: rgba(255, 255, 255, 0.75); 55 | font-size: 1em; } 56 | 57 | .content { 58 | position: relative; 59 | min-height: 100%; } 60 | 61 | .file-list { 62 | width: 200px; 63 | min-height: 100%; 64 | position: absolute; 65 | top: 0; 66 | left: 0; 67 | border-right: solid 8px #24292e; } 68 | .file-list p { 69 | color: #fafbfc; } 70 | .file-list ul { 71 | list-style: none; 72 | margin: 0; 73 | padding: 5px 5px 0; } 74 | .file-list ul li { 75 | position: relative; 76 | padding: 5px; 77 | margin: 0 0 5px; 78 | min-height: 29px; 79 | border: solid 1px transparent; } 80 | .file-list ul li img { 81 | max-width: 100%; 82 | height: auto; 83 | display: block; } 84 | .file-list ul li span { 85 | position: absolute; 86 | bottom: 5px; 87 | left: 5px; 88 | background-color: #333333; 89 | color: #ffffff; 90 | padding: 3px; 91 | font-size: 0.8em; 92 | border-radius: 5px; 93 | opacity: 0; } 94 | .file-list ul li:hover { 95 | border: dashed 1px #FFFFFF; } 96 | .file-list ul li:hover span { 97 | opacity: 1; } 98 | .file-list ul li:hover .remove { 99 | opacity: 1; } 100 | .file-list .remove { 101 | position: absolute; 102 | top: 3px; 103 | right: 3px; 104 | width: 24px; 105 | height: 24px; 106 | background: transparent url("/assets/img/ic_clear_black_24px.svg") 0 0 no-repeat; 107 | cursor: pointer; 108 | opacity: 0.5; 109 | -webkit-filter: invert(1); 110 | filter: invert(1); } 111 | .file-list .remove:hover { 112 | -webkit-transform: scale(1.1); 113 | -ms-transform: scale(1.1); 114 | transform: scale(1.1); } 115 | 116 | .output { 117 | padding: 10px 10px 10px 210px; } 118 | .output b { 119 | font-size: 1.1em; } 120 | 121 | .add-files-btn { 122 | position: absolute; 123 | top: 0; 124 | left: 0; 125 | right: 0; 126 | bottom: 0; 127 | margin: auto; 128 | width: 48px; 129 | height: 48px; 130 | background: transparent url("/assets/img/ic_add_circle_black_48px.svg") center center no-repeat; 131 | cursor: pointer; 132 | display: none; } 133 | 134 | .add-files-text { 135 | position: absolute; 136 | top: 76px; 137 | left: 0; 138 | right: 0; 139 | bottom: 0; 140 | margin: auto; 141 | width: 175px; 142 | height: 20px; 143 | text-align: center; 144 | cursor: pointer; 145 | display: none; } 146 | 147 | .dropbox { 148 | border: solid 1px #E0E0E0; 149 | margin: 0 auto; 150 | float: left; 151 | position: relative; 152 | min-width: 100%; 153 | min-height: 512px; 154 | cursor: pointer; } 155 | .dropbox.is-empty .add-files-btn, .dropbox.is-empty .add-files-text { 156 | display: block; } 157 | 158 | .fileSelect { 159 | display: block; } 160 | 161 | .clear { 162 | width: 100%; 163 | clear: both; } 164 | 165 | .result { 166 | padding: 10px 0 0 0; } 167 | 168 | textarea { 169 | width: 1024px; 170 | font-family: 'Roboto Condensed', sans-serif; 171 | padding: 10px 8px; 172 | background-color: #F5F5F5; 173 | -webkit-box-shadow: none; 174 | box-shadow: none; 175 | border: solid 1px #E0E0E0; } 176 | 177 | .button { 178 | width: 65px; 179 | height: 65px; 180 | border-radius: 5px; 181 | cursor: pointer; 182 | -webkit-transition: background-color 300ms ease; 183 | -o-transition: background-color 300ms ease; 184 | transition: background-color 300ms ease; } 185 | .button:hover { 186 | background-color: #00E5FF; } 187 | .button span { 188 | display: block; 189 | position: absolute; 190 | left: 0; 191 | bottom: 100%; 192 | width: 100%; 193 | font-size: 0.8em; 194 | color: rgba(255, 255, 255, 0.75); 195 | text-align: center; 196 | padding-bottom: 5px; } 197 | 198 | .download { 199 | position: absolute; 200 | bottom: 10px; 201 | right: 10px; 202 | background: rgba(255, 255, 255, 0.125) url("/assets/img/ic_file_download_white_48px.svg") center center no-repeat; } 203 | 204 | .download-info { 205 | font-size: 0.9em; 206 | margin-bottom: 2px; } 207 | 208 | .copy { 209 | position: absolute; 210 | bottom: 10px; 211 | right: 85px; 212 | background: rgba(255, 255, 255, 0.125) url("/assets/img/ic_content_copy_white_48px.svg") center center no-repeat; } 213 | 214 | .github { 215 | position: relative; 216 | left: 10px; 217 | top: 5px; 218 | display: inline-block; 219 | background: transparent url("/assets/img/GitHub-Mark-Light-32px.png") 0 0 no-repeat; 220 | width: 32px; 221 | height: 32px; } 222 | 223 | .dimensions { 224 | font-size: 0.9em; } 225 | 226 | .dark-checkered { 227 | background-color: #757575; 228 | background-image: -o-linear-gradient(45deg, #424242 25%, transparent 25%), -o-linear-gradient(135deg, #424242 25%, transparent 25%), -o-linear-gradient(45deg, transparent 75%, #424242 75%), -o-linear-gradient(135deg, transparent 75%, #424242 75%); 229 | background-image: linear-gradient(45deg, #424242 25%, transparent 25%), linear-gradient(-45deg, #424242 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #424242 75%), linear-gradient(-45deg, transparent 75%, #424242 75%); 230 | background-size: 20px 20px; 231 | background-position: 0 0, 0 10px, 10px -10px, -10px 0px; } 232 | 233 | .light-checkered { 234 | background-color: #f5f5f5; 235 | background-image: -o-linear-gradient(45deg, #e0e0e0 25%, transparent 25%), -o-linear-gradient(135deg, #e0e0e0 25%, transparent 25%), -o-linear-gradient(45deg, transparent 75%, #e0e0e0 75%), -o-linear-gradient(135deg, transparent 75%, #e0e0e0 75%); 236 | background-image: linear-gradient(45deg, #e0e0e0 25%, transparent 25%), linear-gradient(-45deg, #e0e0e0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e0e0e0 75%), linear-gradient(-45deg, transparent 75%, #e0e0e0 75%); 237 | background-size: 20px 20px; 238 | background-position: 0 0, 0 10px, 10px -10px, -10px 0px; } 239 | 240 | 241 | 242 | /*# sourceMappingURL=main.css.map */ 243 | -------------------------------------------------------------------------------- /assets/styles/main.scss: -------------------------------------------------------------------------------- 1 | html { 2 | box-sizing: border-box; 3 | font-family: 'Roboto Condensed', sans-serif; 4 | color: #24292e; 5 | } 6 | 7 | *, *:before, *:after { 8 | box-sizing: inherit; 9 | } 10 | 11 | html, body { 12 | height: 100%; 13 | } 14 | 15 | canvas { 16 | vertical-align: middle; 17 | } 18 | 19 | .page-wrap { 20 | padding-top: 120px; 21 | position: relative; 22 | height: 100%; 23 | } 24 | header { 25 | height: 120px; 26 | width: 100%; 27 | min-width: 1024px; 28 | background-color: #24292e; 29 | position: fixed; 30 | z-index: 3; 31 | padding: 8px 10px 0; 32 | 33 | h1 { 34 | font-size: 2em; 35 | margin: 0 0 2px; 36 | color: #ffffff; 37 | font-weight: normal; 38 | } 39 | h2 { 40 | font-size: 0.85em; 41 | color: rgba(255,255,255,0.75); 42 | font-weight: normal; 43 | margin: 0 0 15px; 44 | } 45 | input { 46 | font-size: 1em; 47 | padding: 6px; 48 | font-family: 'Roboto Condensed', sans-serif; 49 | background-color: rgba(255,255,255,0.125); 50 | color: #fff; 51 | border: none; 52 | border-radius: 2px; 53 | &:last-child { 54 | width: 30px; 55 | text-align: center; 56 | } 57 | &.path-input { 58 | width: 400px; 59 | } 60 | } 61 | label { 62 | color: rgba(255,255,255,0.75); 63 | font-size: 1em; 64 | } 65 | } 66 | .content { 67 | position: relative; 68 | min-height: 100%; 69 | 70 | } 71 | .file-list { 72 | width: 200px; 73 | min-height: 100%; 74 | position: absolute; 75 | top: 0; 76 | left: 0; 77 | //background: transparent url('/assets/img/tile-dark.jpg') 0 0 repeat; 78 | //background-size: 20px; 79 | border-right: solid 8px #24292e; 80 | p { 81 | color: #fafbfc; 82 | } 83 | ul { 84 | list-style: none; 85 | margin: 0; 86 | padding: 5px 5px 0; 87 | li { 88 | position: relative; 89 | padding: 5px; 90 | margin: 0 0 5px; 91 | min-height: 29px; 92 | border: solid 1px transparent; 93 | img { 94 | max-width: 100%; 95 | height: auto; 96 | display: block; 97 | } 98 | span { 99 | position: absolute; 100 | bottom: 5px; 101 | left: 5px; 102 | background-color: #333333; 103 | color: #ffffff; 104 | padding: 3px; 105 | font-size: 0.8em; 106 | border-radius: 5px; 107 | opacity: 0; 108 | } 109 | &:hover { 110 | border: dashed 1px #FFFFFF; 111 | span { 112 | opacity: 1; 113 | } 114 | .remove { 115 | opacity: 1; 116 | } 117 | } 118 | } 119 | } 120 | .remove { 121 | position: absolute; 122 | top: 3px; 123 | right: 3px; 124 | width: 24px; 125 | height: 24px; 126 | background: transparent url('/assets/img/ic_clear_black_24px.svg') 0 0 no-repeat; 127 | cursor: pointer; 128 | opacity: 0.5; 129 | filter: invert(1); 130 | &:hover { 131 | transform: scale(1.1); 132 | } 133 | } 134 | } 135 | 136 | .output { 137 | padding: 10px 10px 10px 210px; 138 | b { 139 | font-size: 1.1em; 140 | } 141 | } 142 | 143 | .add-files-btn { 144 | position: absolute; 145 | top: 0; 146 | left: 0; 147 | right: 0; 148 | bottom: 0; 149 | margin: auto; 150 | width: 48px; 151 | height: 48px; 152 | background: transparent url('/assets/img/ic_add_circle_black_48px.svg') center center no-repeat; 153 | cursor: pointer; 154 | display: none; 155 | } 156 | .add-files-text { 157 | position: absolute; 158 | top: 76px; 159 | left: 0; 160 | right: 0; 161 | bottom: 0; 162 | margin: auto; 163 | width: 175px; 164 | height: 20px; 165 | text-align: center; 166 | cursor: pointer; 167 | display: none; 168 | } 169 | 170 | .dropbox { 171 | border: solid 1px #E0E0E0; 172 | //background: transparent url('/assets/img/tile-light.jpg') 0 0 repeat; 173 | //background-size: 20px; 174 | margin: 0 auto; 175 | float: left; 176 | position: relative; 177 | min-width: 100%; 178 | min-height: 512px; 179 | cursor: pointer; 180 | &.is-empty { 181 | .add-files-btn, .add-files-text { 182 | display: block; 183 | } 184 | } 185 | } 186 | 187 | .fileSelect { 188 | display: block; 189 | } 190 | 191 | .clear { 192 | width: 100%; 193 | clear: both; 194 | } 195 | 196 | .result { 197 | padding: 10px 0 0 0; 198 | } 199 | 200 | textarea { 201 | width: 1024px; 202 | font-family: 'Roboto Condensed', sans-serif; 203 | padding: 10px 8px; 204 | background-color: #F5F5F5; 205 | box-shadow: none; 206 | border: solid 1px #E0E0E0; 207 | } 208 | .button { 209 | width: 65px; 210 | height: 65px; 211 | border-radius: 5px; 212 | cursor: pointer; 213 | transition: background-color 300ms ease; 214 | &:hover { 215 | background-color: #00E5FF; 216 | } 217 | span { 218 | display: block; 219 | position: absolute; 220 | left: 0; 221 | bottom: 100%; 222 | width: 100%; 223 | font-size: 0.8em; 224 | color: rgba(255, 255, 255, 0.75); 225 | text-align: center; 226 | padding-bottom: 5px; 227 | } 228 | } 229 | .download { 230 | position: absolute; 231 | bottom: 10px; 232 | right: 10px; 233 | background: rgba(255,255,255,0.125) url('/assets/img/ic_file_download_white_48px.svg') center center no-repeat; 234 | } 235 | .download-info { 236 | font-size: 0.9em; 237 | margin-bottom: 2px; 238 | } 239 | .copy { 240 | position: absolute; 241 | bottom: 10px; 242 | right: 85px; 243 | background: rgba(255,255,255,0.125) url('/assets/img/ic_content_copy_white_48px.svg') center center no-repeat; 244 | } 245 | .github { 246 | position: relative; 247 | left: 10px; 248 | top: 5px; 249 | display: inline-block; 250 | background: transparent url('/assets/img/GitHub-Mark-Light-32px.png') 0 0 no-repeat; 251 | width: 32px; 252 | height: 32px; 253 | } 254 | .dimensions { 255 | font-size: 0.9em; 256 | } 257 | 258 | .dark-checkered { 259 | background-color: #757575; 260 | background-image: 261 | linear-gradient(45deg, #424242 25%, transparent 25%), 262 | linear-gradient(-45deg, #424242 25%, transparent 25%), 263 | linear-gradient(45deg, transparent 75%, #424242 75%), 264 | linear-gradient(-45deg, transparent 75%, #424242 75%); 265 | background-size: 20px 20px; 266 | background-position: 0 0, 0 10px, 10px -10px, -10px 0px; 267 | } 268 | 269 | .light-checkered { 270 | background-color: #f5f5f5; 271 | background-image: 272 | linear-gradient(45deg, #e0e0e0 25%, transparent 25%), 273 | linear-gradient(-45deg, #e0e0e0 25%, transparent 25%), 274 | linear-gradient(45deg, transparent 75%, #e0e0e0 75%), 275 | linear-gradient(-45deg, transparent 75%, #e0e0e0 75%); 276 | background-size: 20px 20px; 277 | background-position: 0 0, 0 10px, 10px -10px, -10px 0px; 278 | } 279 | -------------------------------------------------------------------------------- /assets/styles/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */ 2 | 3 | /* Document 4 | ========================================================================== */ 5 | 6 | /** 7 | * 1. Correct the line height in all browsers. 8 | * 2. Prevent adjustments of font size after orientation changes in 9 | * IE on Windows Phone and in iOS. 10 | */ 11 | 12 | html { 13 | line-height: 1.15; /* 1 */ 14 | -ms-text-size-adjust: 100%; /* 2 */ 15 | -webkit-text-size-adjust: 100%; /* 2 */ 16 | } 17 | 18 | /* Sections 19 | ========================================================================== */ 20 | 21 | /** 22 | * Remove the margin in all browsers (opinionated). 23 | */ 24 | 25 | body { 26 | margin: 0; 27 | } 28 | 29 | /** 30 | * Add the correct display in IE 9-. 31 | */ 32 | 33 | article, 34 | aside, 35 | footer, 36 | header, 37 | nav, 38 | section { 39 | display: block; 40 | } 41 | 42 | /** 43 | * Correct the font size and margin on `h1` elements within `section` and 44 | * `article` contexts in Chrome, Firefox, and Safari. 45 | */ 46 | 47 | h1 { 48 | font-size: 2em; 49 | margin: 0.67em 0; 50 | } 51 | 52 | /* Grouping content 53 | ========================================================================== */ 54 | 55 | /** 56 | * Add the correct display in IE 9-. 57 | * 1. Add the correct display in IE. 58 | */ 59 | 60 | figcaption, 61 | figure, 62 | main { /* 1 */ 63 | display: block; 64 | } 65 | 66 | /** 67 | * Add the correct margin in IE 8. 68 | */ 69 | 70 | figure { 71 | margin: 1em 40px; 72 | } 73 | 74 | /** 75 | * 1. Add the correct box sizing in Firefox. 76 | * 2. Show the overflow in Edge and IE. 77 | */ 78 | 79 | hr { 80 | box-sizing: content-box; /* 1 */ 81 | height: 0; /* 1 */ 82 | overflow: visible; /* 2 */ 83 | } 84 | 85 | /** 86 | * 1. Correct the inheritance and scaling of font size in all browsers. 87 | * 2. Correct the odd `em` font sizing in all browsers. 88 | */ 89 | 90 | pre { 91 | font-family: monospace, monospace; /* 1 */ 92 | font-size: 1em; /* 2 */ 93 | } 94 | 95 | /* Text-level semantics 96 | ========================================================================== */ 97 | 98 | /** 99 | * 1. Remove the gray background on active links in IE 10. 100 | * 2. Remove gaps in links underline in iOS 8+ and Safari 8+. 101 | */ 102 | 103 | a { 104 | background-color: transparent; /* 1 */ 105 | -webkit-text-decoration-skip: objects; /* 2 */ 106 | } 107 | 108 | /** 109 | * 1. Remove the bottom border in Chrome 57- and Firefox 39-. 110 | * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. 111 | */ 112 | 113 | abbr[title] { 114 | border-bottom: none; /* 1 */ 115 | text-decoration: underline; /* 2 */ 116 | text-decoration: underline dotted; /* 2 */ 117 | } 118 | 119 | /** 120 | * Prevent the duplicate application of `bolder` by the next rule in Safari 6. 121 | */ 122 | 123 | b, 124 | strong { 125 | font-weight: inherit; 126 | } 127 | 128 | /** 129 | * Add the correct font weight in Chrome, Edge, and Safari. 130 | */ 131 | 132 | b, 133 | strong { 134 | font-weight: bolder; 135 | } 136 | 137 | /** 138 | * 1. Correct the inheritance and scaling of font size in all browsers. 139 | * 2. Correct the odd `em` font sizing in all browsers. 140 | */ 141 | 142 | code, 143 | kbd, 144 | samp { 145 | font-family: monospace, monospace; /* 1 */ 146 | font-size: 1em; /* 2 */ 147 | } 148 | 149 | /** 150 | * Add the correct font style in Android 4.3-. 151 | */ 152 | 153 | dfn { 154 | font-style: italic; 155 | } 156 | 157 | /** 158 | * Add the correct background and color in IE 9-. 159 | */ 160 | 161 | mark { 162 | background-color: #ff0; 163 | color: #000; 164 | } 165 | 166 | /** 167 | * Add the correct font size in all browsers. 168 | */ 169 | 170 | small { 171 | font-size: 80%; 172 | } 173 | 174 | /** 175 | * Prevent `sub` and `sup` elements from affecting the line height in 176 | * all browsers. 177 | */ 178 | 179 | sub, 180 | sup { 181 | font-size: 75%; 182 | line-height: 0; 183 | position: relative; 184 | vertical-align: baseline; 185 | } 186 | 187 | sub { 188 | bottom: -0.25em; 189 | } 190 | 191 | sup { 192 | top: -0.5em; 193 | } 194 | 195 | /* Embedded content 196 | ========================================================================== */ 197 | 198 | /** 199 | * Add the correct display in IE 9-. 200 | */ 201 | 202 | audio, 203 | video { 204 | display: inline-block; 205 | } 206 | 207 | /** 208 | * Add the correct display in iOS 4-7. 209 | */ 210 | 211 | audio:not([controls]) { 212 | display: none; 213 | height: 0; 214 | } 215 | 216 | /** 217 | * Remove the border on images inside links in IE 10-. 218 | */ 219 | 220 | img { 221 | border-style: none; 222 | } 223 | 224 | /** 225 | * Hide the overflow in IE. 226 | */ 227 | 228 | svg:not(:root) { 229 | overflow: hidden; 230 | } 231 | 232 | /* Forms 233 | ========================================================================== */ 234 | 235 | /** 236 | * 1. Change the font styles in all browsers (opinionated). 237 | * 2. Remove the margin in Firefox and Safari. 238 | */ 239 | 240 | button, 241 | input, 242 | optgroup, 243 | select, 244 | textarea { 245 | font-family: sans-serif; /* 1 */ 246 | font-size: 100%; /* 1 */ 247 | line-height: 1.15; /* 1 */ 248 | margin: 0; /* 2 */ 249 | } 250 | 251 | /** 252 | * Show the overflow in IE. 253 | * 1. Show the overflow in Edge. 254 | */ 255 | 256 | button, 257 | input { /* 1 */ 258 | overflow: visible; 259 | } 260 | 261 | /** 262 | * Remove the inheritance of text transform in Edge, Firefox, and IE. 263 | * 1. Remove the inheritance of text transform in Firefox. 264 | */ 265 | 266 | button, 267 | select { /* 1 */ 268 | text-transform: none; 269 | } 270 | 271 | /** 272 | * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video` 273 | * controls in Android 4. 274 | * 2. Correct the inability to style clickable types in iOS and Safari. 275 | */ 276 | 277 | button, 278 | html [type="button"], /* 1 */ 279 | [type="reset"], 280 | [type="submit"] { 281 | -webkit-appearance: button; /* 2 */ 282 | } 283 | 284 | /** 285 | * Remove the inner border and padding in Firefox. 286 | */ 287 | 288 | button::-moz-focus-inner, 289 | [type="button"]::-moz-focus-inner, 290 | [type="reset"]::-moz-focus-inner, 291 | [type="submit"]::-moz-focus-inner { 292 | border-style: none; 293 | padding: 0; 294 | } 295 | 296 | /** 297 | * Restore the focus styles unset by the previous rule. 298 | */ 299 | 300 | button:-moz-focusring, 301 | [type="button"]:-moz-focusring, 302 | [type="reset"]:-moz-focusring, 303 | [type="submit"]:-moz-focusring { 304 | outline: 1px dotted ButtonText; 305 | } 306 | 307 | /** 308 | * Correct the padding in Firefox. 309 | */ 310 | 311 | fieldset { 312 | padding: 0.35em 0.75em 0.625em; 313 | } 314 | 315 | /** 316 | * 1. Correct the text wrapping in Edge and IE. 317 | * 2. Correct the color inheritance from `fieldset` elements in IE. 318 | * 3. Remove the padding so developers are not caught out when they zero out 319 | * `fieldset` elements in all browsers. 320 | */ 321 | 322 | legend { 323 | box-sizing: border-box; /* 1 */ 324 | color: inherit; /* 2 */ 325 | display: table; /* 1 */ 326 | max-width: 100%; /* 1 */ 327 | padding: 0; /* 3 */ 328 | white-space: normal; /* 1 */ 329 | } 330 | 331 | /** 332 | * 1. Add the correct display in IE 9-. 333 | * 2. Add the correct vertical alignment in Chrome, Firefox, and Opera. 334 | */ 335 | 336 | progress { 337 | display: inline-block; /* 1 */ 338 | vertical-align: baseline; /* 2 */ 339 | } 340 | 341 | /** 342 | * Remove the default vertical scrollbar in IE. 343 | */ 344 | 345 | textarea { 346 | overflow: auto; 347 | } 348 | 349 | /** 350 | * 1. Add the correct box sizing in IE 10-. 351 | * 2. Remove the padding in IE 10-. 352 | */ 353 | 354 | [type="checkbox"], 355 | [type="radio"] { 356 | box-sizing: border-box; /* 1 */ 357 | padding: 0; /* 2 */ 358 | } 359 | 360 | /** 361 | * Correct the cursor style of increment and decrement buttons in Chrome. 362 | */ 363 | 364 | [type="number"]::-webkit-inner-spin-button, 365 | [type="number"]::-webkit-outer-spin-button { 366 | height: auto; 367 | } 368 | 369 | /** 370 | * 1. Correct the odd appearance in Chrome and Safari. 371 | * 2. Correct the outline style in Safari. 372 | */ 373 | 374 | [type="search"] { 375 | -webkit-appearance: textfield; /* 1 */ 376 | outline-offset: -2px; /* 2 */ 377 | } 378 | 379 | /** 380 | * Remove the inner padding and cancel buttons in Chrome and Safari on macOS. 381 | */ 382 | 383 | [type="search"]::-webkit-search-cancel-button, 384 | [type="search"]::-webkit-search-decoration { 385 | -webkit-appearance: none; 386 | } 387 | 388 | /** 389 | * 1. Correct the inability to style clickable types in iOS and Safari. 390 | * 2. Change font properties to `inherit` in Safari. 391 | */ 392 | 393 | ::-webkit-file-upload-button { 394 | -webkit-appearance: button; /* 1 */ 395 | font: inherit; /* 2 */ 396 | } 397 | 398 | /* Interactive 399 | ========================================================================== */ 400 | 401 | /* 402 | * Add the correct display in IE 9-. 403 | * 1. Add the correct display in Edge, IE, and Firefox. 404 | */ 405 | 406 | details, /* 1 */ 407 | menu { 408 | display: block; 409 | } 410 | 411 | /* 412 | * Add the correct display in all browsers. 413 | */ 414 | 415 | summary { 416 | display: list-item; 417 | } 418 | 419 | /* Scripting 420 | ========================================================================== */ 421 | 422 | /** 423 | * Add the correct display in IE 9-. 424 | */ 425 | 426 | canvas { 427 | display: inline-block; 428 | } 429 | 430 | /** 431 | * Add the correct display in IE. 432 | */ 433 | 434 | template { 435 | display: none; 436 | } 437 | 438 | /* Hidden 439 | ========================================================================== */ 440 | 441 | /** 442 | * Add the correct display in IE 10-. 443 | */ 444 | 445 | [hidden] { 446 | display: none; 447 | } -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eivers88/responsive-css-sprite-generator/f463d5509529407705c48470e6f5612068742396/favicon.ico -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** GULP DEPENDENCIES 4 | ========================================================================== */ 5 | 6 | let gulp = require('gulp'); 7 | let sass = require('gulp-ruby-sass'); 8 | let autoprefixer = require('gulp-autoprefixer'); 9 | let sourcemaps = require('gulp-sourcemaps'); 10 | let browserSync = require('browser-sync').create(); 11 | let usemin = require('gulp-usemin'); 12 | let uglify = require('gulp-uglify'); 13 | let htmlmin = require('gulp-htmlmin'); 14 | let cleanCss = require('gulp-clean-css'); 15 | let rev = require('gulp-rev'); 16 | 17 | /** DEFAULT 18 | ========================================================================== */ 19 | 20 | gulp.task('default', ['usemin']); 21 | 22 | /** STYLESHEETS 23 | ========================================================================== */ 24 | 25 | gulp.task('clear:cache', function () { 26 | sass.clearCache(); 27 | }); 28 | 29 | gulp.task('clean:sass', ['clear:cache'], sassTask); 30 | 31 | gulp.task('sass', sassTask); 32 | 33 | function sassTask() { 34 | return sass('./assets/styles/**/*.scss', {sourcemap: true}) 35 | .on('error', sass.logError) 36 | .pipe(autoprefixer({ 37 | browsers: ['last 3 versions'], 38 | cascade: false 39 | })) 40 | .pipe(sourcemaps.write('.')) 41 | .pipe(gulp.dest('./assets/styles')) 42 | .pipe(browserSync.stream({match: '**/*.css'})); 43 | } 44 | 45 | /** USEMIN 46 | ========================================================================== */ 47 | 48 | gulp.task('usemin', function () { 49 | return gulp.src('./src/index.html') 50 | .pipe(usemin({ 51 | html: [htmlmin({collapseWhitespace: true})], 52 | jsAttributes: { 53 | async: true 54 | }, 55 | js: [uglify(), rev()], 56 | inlinecss: [cleanCss(), 'concat'] 57 | })) 58 | .pipe(gulp.dest('./')); 59 | }); 60 | 61 | /** WATCH 62 | ========================================================================== */ 63 | 64 | gulp.task('watch', ['clean:sass'], function () { 65 | 66 | browserSync.init({ 67 | server: { 68 | baseDir: './', 69 | index: './src/index.html' 70 | } 71 | }); 72 | 73 | gulp.watch('./assets/js/bundle.js').on('change', browserSync.reload); 74 | gulp.watch('./src/*.html').on('change', browserSync.reload); 75 | gulp.watch('./assets/styles/**/*.scss', ['sass']); 76 | 77 | }); 78 | 79 | 80 | /** BUILD SERVER 81 | ========================================================================== */ 82 | 83 | gulp.task('build-server', ['clean:sass'], function () { 84 | 85 | browserSync.init({ 86 | server: { 87 | baseDir: './', 88 | index: './index.html' 89 | }, 90 | port: 8080 91 | }); 92 | 93 | }); 94 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 |