diff --git a/.gitignore b/.gitignore index 79daa31..4c7eb55 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ npm-debug.log # Cache .sass-cache css +_css *.css.map # IDE's diff --git a/app/grunt-watcher.js b/app/grunt-watcher.js index 0255d5c..cf671c0 100644 --- a/app/grunt-watcher.js +++ b/app/grunt-watcher.js @@ -13,16 +13,20 @@ module.exports = gruntWatcher; function gruntWatcher() { // Start grunt watcher (which in turn starts sass watcher and autoprefixer) - var sassProcess = exec('grunt watcher', function(err, stdout, stderr) { + var gruntProcess = exec('grunt watcher', function(err, stdout, stderr) { if (err) { console.log(ansi.red[0], err, stderr, ansi.red[1]); } console.log(stdout); }); + // Output data + gruntProcess.stdout.pipe(process.stdout); + gruntProcess.stderr.pipe(process.stderr); + // Exit watcher when node.js is getting killed process.on('SIGINT', function() { - sassProcess.kill(); + gruntProcess.kill(); process.exit(); }); diff --git a/bower.json b/bower.json index 6e2cd42..f0c21a5 100644 --- a/bower.json +++ b/bower.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "dependencies": { - "conditioner": "~1.0.0", - "requirejs": "~2.1.11" + "conditioner": "~1.0.1", + "requirejs": "~2.1.15" } } diff --git a/gruntfile.js b/gruntfile.js index 00bdcfc..3d77944 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -40,9 +40,10 @@ module.exports = function Gruntfile(grunt) { // jshint ignore:line watch: { scss: { files: ['src/static/scss/**/*.scss'], - tasks: ['sass:dev', 'autoprefixer', 'clean:sass'], + tasks: ['sass:dev', 'autoprefixer'], options: { - spawn: false + spawn: false, + atBegin: true } } }, @@ -50,7 +51,8 @@ module.exports = function Gruntfile(grunt) { // jshint ignore:line sass: { dev: { options: { - style: 'expanded' + style: 'expanded', + update: true }, files: [{ expand: true, @@ -63,7 +65,8 @@ module.exports = function Gruntfile(grunt) { // jshint ignore:line prod: { options: { style: 'compressed', - noCache: true + noCache: true, + sourcemap: 'none' }, files: [{ expand: true, @@ -77,7 +80,9 @@ module.exports = function Gruntfile(grunt) { // jshint ignore:line autoprefixer: { options: { - browsers: config.server.sassBrowsers + browsers: config.server.sassBrowsers, + map: true, + cascade: false }, dist: { expand: true, @@ -125,13 +130,19 @@ module.exports = function Gruntfile(grunt) { // jshint ignore:line imagemin: { options: { - pngquant: true + pngquant: true, + optimizationLevel: 7, + svgoPlugins: [ + { removeViewBox: false }, // don't remove the viewbox atribute from the SVG + { removeUselessStrokeAndFill: false }, // don't remove Useless Strokes and Fills + { removeEmptyAttrs: false } // don't remove Empty Attributes from the SVG] + ] }, dist: { files: [{ expand: true, cwd: 'src/static/img/', - src: ['**/*.{png,jpg,gif}'], + src: ['**/*.{png,jpg,gif,svg}'], dest: 'build/static/img/' }] } @@ -139,7 +150,8 @@ module.exports = function Gruntfile(grunt) { // jshint ignore:line uglify: { options: { - sourceMap: true + sourceMap: true, + preserveComments: 'some' // preserve copyright notice and stuff like that }, dist: { files: [{ @@ -308,8 +320,6 @@ module.exports = function Gruntfile(grunt) { // jshint ignore:line // Watch task. grunt.registerTask('watcher', [ - 'sass:dev', - 'autoprefixer', 'clean:sass', 'watch' ]); diff --git a/package.json b/package.json index 1866654..4b1dc3f 100644 --- a/package.json +++ b/package.json @@ -35,18 +35,18 @@ }, "devDependencies": { "grunt": "^0.4.5", - "grunt-autoprefixer": "^0.8.0", - "grunt-contrib-clean": "^0.5.0", - "grunt-contrib-compress": "^0.9.1", - "grunt-contrib-copy": "^0.5.0", - "grunt-contrib-imagemin": "^0.7.1", + "grunt-autoprefixer": "^2.0.0", + "grunt-contrib-clean": "^0.6.0", + "grunt-contrib-compress": "^0.12.0", + "grunt-contrib-copy": "^0.7.0", + "grunt-contrib-imagemin": "^0.9.2", "grunt-contrib-jshint": "^0.10.0", - "grunt-contrib-sass": "^0.7.2", - "grunt-contrib-uglify": "^0.5.0", + "grunt-contrib-sass": "^0.8.1", + "grunt-contrib-uglify": "^0.6.0", "grunt-contrib-watch": "^0.6.1", "grunt-csso": "^0.6.2", - "grunt-ftp-deploy": "^0.1.1", + "grunt-ftp-deploy": "^0.1.9", "grunt-httpcopy": "^0.3.0", - "grunt-scss-lint": "^0.1.11" + "grunt-scss-lint": "^0.3.4" } } diff --git a/src/static/js/ui/docs/iframeHeightResizer.js b/src/static/js/ui/docs/iframeHeightResizer.js index fa28fcf..89001c0 100644 --- a/src/static/js/ui/docs/iframeHeightResizer.js +++ b/src/static/js/ui/docs/iframeHeightResizer.js @@ -1,20 +1,36 @@ // // Module: Quick Reference Card // -define(function iframeHeightResizer() { +define(function() { 'use strict'; - function resizeIframeHeight(iframe) { - iframe.style.height = iframe.contentDocument.body.scrollHeight + 10 + 'px'; + /** + * @constructor + */ + function iframeHeightResizer(elem) { + this.iframe = elem; + this.bindOnLoad(); + this.onLoad(); } - return function(iframe) { - - iframe.contentWindow.addEventListener('load', resizeIframeHeight); + /** + * Bind events + */ + iframeHeightResizer.prototype.bindOnLoad = function() { + document.addEventListener('readystatechange', this.onLoad.bind(this)); + }; - // Load event already fired? Run now + /** + * Event handler + */ + iframeHeightResizer.prototype.onLoad = function() { if (document.readyState === 'complete') { - resizeIframeHeight(iframe); + this.iframe.style.height = this.iframe.contentDocument.body.scrollHeight + 10 + 'px'; } }; + + /** + * Expose constructor + */ + return iframeHeightResizer; }); diff --git a/src/static/scss/common/_colors.scss b/src/static/scss/common/_colors.scss index 8b46026..60e373a 100644 --- a/src/static/scss/common/_colors.scss +++ b/src/static/scss/common/_colors.scss @@ -16,5 +16,4 @@ $colors: 'off-black' #333, 'black' #202020, 'muted-text' #909090, - 'line-on-black' #7d7d7d -; + 'line-on-black' #7d7d7d;