From 62bf313c6a774a73219ababdfea45347334fb033 Mon Sep 17 00:00:00 2001 From: Amos Haviv Date: Tue, 20 May 2014 20:19:51 +0300 Subject: [PATCH] Simplified Gruntfile, Minor Bug Fixing --- app/views/layout.server.view.html | 1 + gruntfile.js | 38 +++++++++++------ package.json | 4 +- .../articles/config/articles.client.routes.js | 42 +++++++++---------- .../controllers/header.client.controller.js | 5 +++ .../modules/core/views/home.client.view.html | 2 +- 6 files changed, 55 insertions(+), 37 deletions(-) diff --git a/app/views/layout.server.view.html b/app/views/layout.server.view.html index e13028ae..32ea5626 100644 --- a/app/views/layout.server.view.html +++ b/app/views/layout.server.view.html @@ -62,6 +62,7 @@ {% if process.env.NODE_ENV === 'development' %} + {% endif %} diff --git a/gruntfile.js b/gruntfile.js index 426b22b9..a924c9a7 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -1,47 +1,57 @@ 'use strict'; module.exports = function(grunt) { + // Unified Watch Object + var watchFiles = { + serverViews: ['app/views/**/*.*'], + serverJS: ['gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js'], + clientViews: ['public/modules/**/views/*.html'], + clientJS: ['public/js/*.js', 'public/modules/**/*.js'], + clientCSS: ['public/modules/**/*.css'], + mochaTests: ['app/tests/**/*.js'] + }; + // Project Configuration grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), watch: { serverViews: { - files: ['app/views/**'], + files: watchFiles.serverViews, options: { - livereload: true, + livereload: true } }, serverJS: { - files: ['gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js'], + files: watchFiles.serverJS, tasks: ['jshint'], options: { - livereload: true, + livereload: true } }, clientViews: { - files: ['public/modules/**/views/*.html'], + files: watchFiles.clientViews, options: { livereload: true, } }, clientJS: { - files: ['public/js/*.js', 'public/modules/**/*.js'], + files: watchFiles.clientJS, tasks: ['jshint'], options: { - livereload: true, + livereload: true } }, clientCSS: { - files: ['public/**/css/*.css'], + files: watchFiles.clientCSS, tasks: ['csslint'], options: { - livereload: true, + livereload: true } } }, jshint: { all: { - src: ['gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js', 'public/js/**/*.js', 'public/modules/**/*.js'], + src: watchFiles.clientJS.concat(watchFiles.serverJS), options: { jshintrc: true } @@ -52,7 +62,7 @@ module.exports = function(grunt) { csslintrc: '.csslintrc', }, all: { - src: ['public/modules/**/css/*.css'] + src: watchFiles.clientCSS } }, uglify: { @@ -76,7 +86,9 @@ module.exports = function(grunt) { dev: { script: 'server.js', options: { - nodeArgs: ['--debug'] + nodeArgs: ['--debug'], + ext: 'js, html', + watch: watchFiles.serverViews.concat(watchFiles.serverJS) } } }, @@ -113,7 +125,7 @@ module.exports = function(grunt) { } }, mochaTest: { - src: ['app/tests/**/*.js'], + src: watchFiles.mochaTests, options: { reporter: 'spec', require: 'server.js' diff --git a/package.json b/package.json index 3c3c39d3..02e56813 100755 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "grunt-nodemon": "~0.2.1", "grunt-concurrent": "~0.5.0", "grunt-mocha-test": "~0.10.0", - "grunt-ngmin": "0.0.3", + "grunt-ngmin": "0.0.3", "grunt-karma": "~0.8.2", "load-grunt-tasks": "~0.4.0", "karma": "~0.12.0", @@ -66,4 +66,4 @@ "karma-firefox-launcher": "~0.1.3", "karma-phantomjs-launcher": "~0.1.2" } -} +} \ No newline at end of file diff --git a/public/modules/articles/config/articles.client.routes.js b/public/modules/articles/config/articles.client.routes.js index 426fefb3..1531a9a5 100755 --- a/public/modules/articles/config/articles.client.routes.js +++ b/public/modules/articles/config/articles.client.routes.js @@ -2,24 +2,24 @@ // Setting up route angular.module('articles').config(['$stateProvider', - function($stateProvider) { - // Articles state routing - $stateProvider. - state('listArticles', { - url: '/articles', - templateUrl: 'modules/articles/views/list-articles.client.view.html' - }). - state('createArticle', { - url: '/articles/create', - templateUrl: 'modules/articles/views/create-article.client.view.html' - }). - state('viewArticle', { - url: '/articles/:articleId', - templateUrl: 'modules/articles/views/view-article.client.view.html' - }). - state('editArticle', { - url: '/articles/:articleId/edit', - templateUrl: 'modules/articles/views/edit-article.client.view.html' - }); - } -]); + function($stateProvider) { + // Articles state routing + $stateProvider. + state('listArticles', { + url: '/articles', + templateUrl: 'modules/articles/views/list-articles.client.view.html' + }). + state('createArticle', { + url: '/articles/create', + templateUrl: 'modules/articles/views/create-article.client.view.html' + }). + state('viewArticle', { + url: '/articles/:articleId', + templateUrl: 'modules/articles/views/view-article.client.view.html' + }). + state('editArticle', { + url: '/articles/:articleId/edit', + templateUrl: 'modules/articles/views/edit-article.client.view.html' + }); + } +]); \ No newline at end of file diff --git a/public/modules/core/controllers/header.client.controller.js b/public/modules/core/controllers/header.client.controller.js index 4fe41f2a..1b8c2b7b 100644 --- a/public/modules/core/controllers/header.client.controller.js +++ b/public/modules/core/controllers/header.client.controller.js @@ -9,5 +9,10 @@ angular.module('core').controller('HeaderController', ['$scope', 'Authentication $scope.toggleCollapsibleMenu = function() { $scope.isCollapsed = !$scope.isCollapsed; }; + + // Collapsing the menu after navigation + $scope.$on('$stateChangeSuccess', function() { + $scope.isCollapsed = false; + }); } ]); \ No newline at end of file diff --git a/public/modules/core/views/home.client.view.html b/public/modules/core/views/home.client.view.html index 9f8d370d..2279da03 100644 --- a/public/modules/core/views/home.client.view.html +++ b/public/modules/core/views/home.client.view.html @@ -5,7 +5,7 @@

- 140x140 + MEAN.JS

Open-Source Full-Stack Solution For MEAN Applications