From 8bca393d16120c381b0e8c087d7199df3f59adb5 Mon Sep 17 00:00:00 2001 From: Kaspar Naaber Date: Tue, 7 Oct 2014 17:24:23 +0300 Subject: [PATCH] Update Gruntfile and rerun grunt tasks --- Gruntfile.js | 112 +++++++++++++++++++++--------------- assets/close-round-dark.svg | 2 +- assets/close-round.svg | 2 +- assets/ico-search-dark.svg | 2 +- assets/ico-search.svg | 2 +- assets/ico-tag-dark.svg | 2 +- assets/ico-tag.svg | 2 +- javascripts/application.js | 8 +-- manifest.json | 36 ++++++------ package.json | 16 ++++-- 10 files changed, 106 insertions(+), 78 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 1ba2e66..5ff0414 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,14 +1,5 @@ module.exports = function(grunt) { - grunt.loadNpmTasks('grunt-bowercopy'); - grunt.loadNpmTasks('grunt-modernizr'); - grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-sass'); - grunt.loadNpmTasks('grunt-contrib-cssmin'); - grunt.loadNpmTasks('grunt-contrib-imagemin'); - grunt.loadNpmTasks('grunt-svgmin'); - grunt.loadNpmTasks('grunt-newer'); - grunt.loadNpmTasks('grunt-contrib-watch'); + "use strict"; grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), @@ -55,7 +46,24 @@ module.exports = function(grunt) { } }, - // Concatenates javascripts into one file. + // Copys the standalone (not concatenated) javascript source files to the javascripts folder. + copy: { + javascripts: { + files: [ + { + expand: true, + cwd: 'javascripts/src', + src: [ + '*.js', + '!modernizr.js' + ], + dest: 'javascripts/' + } + ] + } + }, + + // Concatenates the javascript source files to the javascripts folder. concat: { build: { src: [ @@ -84,11 +92,11 @@ module.exports = function(grunt) { // Compiles the stylesheet files. sass: { - options: { - style: 'expanded', - sourcemap: 'none' - }, build: { + options: { + style: 'expanded', + sourcemap: 'none' + }, files: [{ expand: true, cwd: 'stylesheets/scss', @@ -99,6 +107,19 @@ module.exports = function(grunt) { } }, + exec: { + kitmanifest: { + cmd: function(file) { + return 'kit manifest'; + } + }, + kit: { + cmd: function(file) { + return 'kit push -s ' + grunt.option('site') + ' ' + file; + } + } + }, + // Minifies the stylesheet files. cssmin: { build: { @@ -115,7 +136,7 @@ module.exports = function(grunt) { // Minifies the image files. imagemin: { - images: { + build: { files: [{ expand: true, cwd: 'images/src/', @@ -140,41 +161,18 @@ module.exports = function(grunt) { // Watches the project for changes and recompiles the output files. watch: { - concat: { + js: { files: 'javascripts/src/concat/*.js', - tasks: 'concat' - }, - - uglify: { - files: [ - 'javascripts/*.js', - '!javascripts/*.min.js' - ], - tasks: 'newer:uglify', - options: { - spawn: false - } + tasks: ['newer:concat', 'newer:uglify'] }, css: { files: 'stylesheets/scss/*.scss', - tasks: ['sass', 'cssmin'], - options: { - spawn: false - } + tasks: ['sass:build', 'newer:cssmin:build'] }, - imagemin: { - files: 'images/src/*.{png,jpg,gif}', - tasks: 'newer:imagemin', - options: { - spawn: false - } - }, - - svgmin: { - files: 'assets/src/*.svg', - tasks: 'newer:svgmin', + voog: { + files: ['javascripts/*.js', 'stylesheets/*.css', 'layouts/*.tpl', 'components/*.tpl'], options: { spawn: false } @@ -182,5 +180,29 @@ module.exports = function(grunt) { }, }); - grunt.registerTask('default', ['bowercopy', 'modernizr', 'concat', 'uglify', 'sass', 'cssmin', 'imagemin', 'svgmin']); + grunt.loadNpmTasks('grunt-bowercopy'); + grunt.loadNpmTasks('grunt-modernizr'); + grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-sass'); + grunt.loadNpmTasks('grunt-contrib-cssmin'); + grunt.loadNpmTasks('grunt-contrib-imagemin'); + grunt.loadNpmTasks('grunt-svgmin'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-newer'); + grunt.loadNpmTasks('grunt-exec'); + + grunt.registerTask('default', ['bowercopy', 'modernizr', 'copy', 'concat', 'uglify', 'sass', 'cssmin', 'imagemin', 'svgmin']); + + grunt.event.on('watch', function(action, filepath, target) { + if (target == 'voog') { + if (action == "added" || action == "deleted") { + grunt.task.run(['exec:kitmanifest']); + } + if (action != "deleted") { + grunt.task.run(['exec:kit:' + filepath]); + } + } + }); }; diff --git a/assets/close-round-dark.svg b/assets/close-round-dark.svg index 15ffad5..eec9cb1 100644 --- a/assets/close-round-dark.svg +++ b/assets/close-round-dark.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/close-round.svg b/assets/close-round.svg index 9336d6a..73e453f 100644 --- a/assets/close-round.svg +++ b/assets/close-round.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/ico-search-dark.svg b/assets/ico-search-dark.svg index 87f4d5f..a89980b 100644 --- a/assets/ico-search-dark.svg +++ b/assets/ico-search-dark.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/ico-search.svg b/assets/ico-search.svg index fba8216..10035fa 100644 --- a/assets/ico-search.svg +++ b/assets/ico-search.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/ico-tag-dark.svg b/assets/ico-tag-dark.svg index ec9c5b6..14632a1 100644 --- a/assets/ico-tag-dark.svg +++ b/assets/ico-tag-dark.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/assets/ico-tag.svg b/assets/ico-tag.svg index cc36e34..3db5003 100644 --- a/assets/ico-tag.svg +++ b/assets/ico-tag.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/javascripts/application.js b/javascripts/application.js index cbbccab..2497aea 100644 --- a/javascripts/application.js +++ b/javascripts/application.js @@ -11526,7 +11526,7 @@ MMCQ = (function() { }; // SCROLLS TO THE COMMENT-FORM IF COMMENT SUBMIT FAILED (TO SHOW THE ERROR MESSAGES TO THE USER) - var focusCommentsWithErrors = function() { + var focusFormWithErrors = function() { $(document).ready(function() { if ($('.comment-form').hasClass('form_with_errors')) { $('html, body').scrollTop($('.comment-form').offset().top); @@ -11649,12 +11649,12 @@ MMCQ = (function() { var initArticlePage = function() { // ADD SINGLE POST VIEW SPECIFIC FUNCTIONS HERE - focusCommentsWithErrors(); + focusFormWithErrors(); }; var initCommonPage = function() { // ADD COMMON PAGE SPECIFIC FUNCTIONS HERE - focusCommentsWithErrors(); + focusFormWithErrors(); }; var initFrontPage = function() { @@ -11665,7 +11665,7 @@ MMCQ = (function() { } }); $(window).on('resize', resizeContentRight); - focusCommentsWithErrors(); + focusFormWithErrors(); }; var resizeTimeout; diff --git a/manifest.json b/manifest.json index 0b38377..2141d41 100644 --- a/manifest.json +++ b/manifest.json @@ -139,11 +139,11 @@ "title": "menu-mobile" }, { - "content_type": "component", - "component": true, - "file": "components/news.tpl", - "layout_name": "news", - "title": "news" + "content_type": "blog", + "component": false, + "file": "layouts/blog___news.tpl", + "layout_name": "blog", + "title": "Blog & News" }, { "content_type": "component", @@ -203,6 +203,18 @@ } ], "assets": [ + { + "content_type": "image/svg+xml", + "file": "assets/arr-bottom.svg", + "kind": "assets", + "filename": "arr-bottom.svg" + }, + { + "content_type": "image/svg+xml", + "file": "assets/arr-top.svg", + "kind": "assets", + "filename": "arr-top.svg" + }, { "content_type": "image/svg+xml", "file": "assets/close-round-dark.svg", @@ -322,18 +334,6 @@ "file": "stylesheets/main.min.css", "kind": "stylesheets", "filename": "main.min.css" - }, - { - "content_type": "image/svg+xml", - "kind": "assets", - "file": "assets/arr-bottom.svg", - "filename": "arr-bottom.svg" - }, - { - "content_type": "image/svg+xml", - "kind": "assets", - "file": "assets/arr-top.svg", - "filename": "arr-top.svg" } ] -} \ No newline at end of file +} diff --git a/package.json b/package.json index c2be98b..2e34e82 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,23 @@ { "name": "voog-design-reykjavik", "description": "The Reykjavik design template for Voog", + "repository": { + "type": "git", + "url": "git://github.com/Edicy/design-reykjavik.git" + }, "devDependencies": { "grunt": "^0.4.5", "grunt-bowercopy": "^1.1.0", - "grunt-modernizr": "^0.5.2", "grunt-contrib-concat": "^0.4.0", - "grunt-contrib-uglify": "^0.5.0", - "grunt-contrib-sass": "^0.7.3", + "grunt-contrib-copy": "^0.6.0", "grunt-contrib-cssmin": "^0.10.0", "grunt-contrib-imagemin": "^0.7.1", - "grunt-svgmin": "^0.4.0", + "grunt-contrib-sass": "^0.7.3", + "grunt-contrib-uglify": "^0.5.0", + "grunt-contrib-watch": "^0.6.1", + "grunt-exec": "^0.4.6", + "grunt-modernizr": "^0.5.2", "grunt-newer": "^0.7.0", - "grunt-contrib-watch": "^0.6.1" + "grunt-svgmin": "^0.4.0" } }