From ac4eb18b55eb67ecc9220a2a1c18e60fe5e166da Mon Sep 17 00:00:00 2001 From: perploug Date: Wed, 4 Sep 2013 23:31:05 +0200 Subject: [PATCH] Add ngmin and uglify to grunt setup RERUN NPM INSTALL --- src/Umbraco.Web.UI.Client/gruntFile.js | 150 +++++++++++++------------ src/Umbraco.Web.UI.Client/package.json | 96 ++++++++-------- 2 files changed, 127 insertions(+), 119 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/gruntFile.js b/src/Umbraco.Web.UI.Client/gruntFile.js index 269b4545f7..f1f5982cf6 100644 --- a/src/Umbraco.Web.UI.Client/gruntFile.js +++ b/src/Umbraco.Web.UI.Client/gruntFile.js @@ -5,17 +5,17 @@ module.exports = function (grunt) { grunt.registerTask('dev', ['jshint:dev', 'build', 'webserver', 'open:dev', 'watch']); //run by the watch task - grunt.registerTask('watch-js', ['jshint:dev','concat','copy:app','copy:mocks','copy:packages','karma:unit', 'copy:vs']); + grunt.registerTask('watch-js', ['jshint:dev','concat:dev','copy:app','copy:mocks','copy:packages','copy:vs','karma:unit']); grunt.registerTask('watch-less', ['recess:build','copy:assets','copy:vs']); grunt.registerTask('watch-html', ['copy:views', 'copy:vs']); grunt.registerTask('watch-packages', ['copy:packages']); grunt.registerTask('watch-test', ['jshint:dev', 'karma:unit']); //triggered from grunt dev or grunt - grunt.registerTask('build', ['clean','concat','recess:build','copy']); + grunt.registerTask('build', ['clean','concat','uglify','recess:build','copy']); //utillity tasks - grunt.registerTask('docs', ['markdown', 'ngdocs']); + grunt.registerTask('docs', ['ngdocs']); grunt.registerTask('webserver', ['connect:devserver']); @@ -97,7 +97,6 @@ module.exports = function (grunt) { { dest: '<%= distdir %>/js', src : '*.js', expand: true, cwd: 'src/' } ] }, - mocks: { files: [{ dest: '<%= distdir %>/js', src : '*.js', expand: true, cwd: 'src/common/mocks/' }] }, @@ -124,71 +123,82 @@ module.exports = function (grunt) { }, concat:{ - index: { - src: ['src/index.html'], - dest: '<%= distdir %>/index.html', - options: { - process: true + index: { + src: ['src/index.html'], + dest: '<%= distdir %>/index.html', + options: { + process: true + } + }, + controllers: { + src:['src/views/**/*.controller.js'], + dest: '<%= distdir %>/js/umbraco.controllers.js', + options: { + banner: "<%= banner %>\n(function() { \n\n", + footer: "\n\n})();" + } + }, + services: { + src:['src/common/services/*.js'], + dest: '<%= distdir %>/js/umbraco.services.js', + options: { + banner: "<%= banner %>\n(function() { \n\n", + footer: "\n\n})();" + } + }, + security: { + src:['src/common/security/*.js'], + dest: '<%= distdir %>/js/umbraco.security.js', + options: { + banner: "<%= banner %>\n(function() { \n\n", + footer: "\n\n})();" + } + }, + resources: { + src:['src/common/resources/*.js'], + dest: '<%= distdir %>/js/umbraco.resources.js', + options: { + banner: "<%= banner %>\n(function() { \n\n", + footer: "\n\n})();" + } + }, + testing: { + src:['src/common/mocks/resources/*.js'], + dest: '<%= distdir %>/js/umbraco.testing.js', + options: { + banner: "<%= banner %>\n(function() { \n\n", + footer: "\n\n})();" + } + }, + directives: { + src:['src/common/directives/**/*.js'], + dest: '<%= distdir %>/js/umbraco.directives.js', + options: { + banner: "<%= banner %>\n(function() { \n\n", + footer: "\n\n})();" + } + }, + filters: { + src:['src/common/filters/*.js'], + dest: '<%= distdir %>/js/umbraco.filters.js', + options: { + banner: "<%= banner %>\n(function() { \n\n", + footer: "\n\n})();" + } } + }, + + uglify: { + options: { + mangle: true }, - controllers: { - src:['src/views/**/*.controller.js'], - dest: '<%= distdir %>/js/umbraco.controllers.js', - options: { - banner: "<%= banner %>\n(function() { \n\n", - footer: "\n\n})();" - } - }, - services: { - src:['src/common/services/*.js'], - dest: '<%= distdir %>/js/umbraco.services.js', - options: { - banner: "<%= banner %>\n(function() { \n\n", - footer: "\n\n})();" - } - }, - security: { - src:['src/common/security/*.js'], - dest: '<%= distdir %>/js/umbraco.security.js', - options: { - banner: "<%= banner %>\n(function() { \n\n", - footer: "\n\n})();" - } - }, - resources: { - src:['src/common/resources/*.js'], - dest: '<%= distdir %>/js/umbraco.resources.js', - options: { - banner: "<%= banner %>\n(function() { \n\n", - footer: "\n\n})();" - } - }, - testing: { - src:['src/common/mocks/resources/*.js'], - dest: '<%= distdir %>/js/umbraco.testing.js', - options: { - banner: "<%= banner %>\n(function() { \n\n", - footer: "\n\n})();" - } - }, - directives: { - src:['src/common/directives/**/*.js'], - dest: '<%= distdir %>/js/umbraco.directives.js', - options: { - banner: "<%= banner %>\n(function() { \n\n", - footer: "\n\n})();" - } - }, - filters: { - src:['src/common/filters/*.js'], - dest: '<%= distdir %>/js/umbraco.filters.js', - options: { - banner: "<%= banner %>\n(function() { \n\n", - footer: "\n\n})();" + my_target: { + files: { + '<%= distdir %>/js/umbraco.min.js': ['<%= distdir %>/js/umbraco.*.js'] } } }, - + recess: { build: { files: { @@ -208,6 +218,8 @@ module.exports = function (grunt) { } }, + + watch:{ css: { files: '**/*.less', @@ -235,12 +247,6 @@ module.exports = function (grunt) { } }, - markdown: { - all: { - files: ['docs/src/*.md'], - dest: 'docs/html/' - } - }, ngdocs: { options: { @@ -316,6 +322,7 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-recess'); @@ -324,6 +331,7 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-open'); grunt.loadNpmTasks('grunt-contrib-connect'); - grunt.loadNpmTasks('grunt-markdown'); grunt.loadNpmTasks('grunt-ngdocs'); + grunt.loadNpmTasks('grunt-ngmin'); + }; diff --git a/src/Umbraco.Web.UI.Client/package.json b/src/Umbraco.Web.UI.Client/package.json index 8cd67130d6..7e4b6e9675 100644 --- a/src/Umbraco.Web.UI.Client/package.json +++ b/src/Umbraco.Web.UI.Client/package.json @@ -1,48 +1,48 @@ -{ - "author": "Umbraco HQ", - "name": "umbraco", - "homepage": "https://github.com/umbraco/umbraco-cms/tree/7.0.0", - "version": "0.0.1-TechnicalPReview", - "repository": { - "type": "git", - "url": "git@github.com:umbraco/umbraco-cms.git" - }, - "bugs": { - "url": "https://issues.umbraco.org" - }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/umbraco/Umbraco-CMS/blob/7.0.0/docs/License.txt" - } - ], - "engines": { - "node": ">= 0.8.4" - }, - "dependencies": {}, - "devDependencies": { - "grunt": "~0.4.0", - "phantomjs": "~1.9.1-0", - "grunt-recess": "~0.3", - "grunt-contrib-clean": "~0.4.0", - "grunt-contrib-copy": "~0.4.0", - "grunt-contrib-jshint": "~0.2.0", - "grunt-contrib-concat": "~0.1.3", - "grunt-contrib-uglify": "~0.1.1", - "grunt-html2js": "~0.1.0", - "grunt-contrib-watch": "~0.3.1", - "grunt-markdown": "~0.2.0", - "grunt-open": "~0.2.0", - "grunt-contrib-connect": "~0.3.0", - "grunt-karma": "~0.5", - "karma-chrome-launcher": "0.0.2", - "karma-script-launcher": "0.0.1", - "karma-firefox-launcher": "0.0.2", - "karma-jasmine": "0.0.1", - "karma-requirejs": "0.0.1", - "karma-coffee-preprocessor": "0.0.1", - "karma": "~0.9", - "karma-phantomjs-launcher": "0.0.2", - "grunt-ngdocs": "~0.1.2" - } -} +{ + "author": "Umbraco HQ", + "name": "umbraco", + "homepage": "https://github.com/umbraco/umbraco-cms/tree/7.0.0", + "version": "0.0.1-TechnicalPReview", + "repository": { + "type": "git", + "url": "git@github.com:umbraco/umbraco-cms.git" + }, + "bugs": { + "url": "https://issues.umbraco.org" + }, + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/umbraco/Umbraco-CMS/blob/7.0.0/docs/License.txt" + } + ], + "engines": { + "node": ">= 0.8.4" + }, + "dependencies": {}, + "devDependencies": { + "grunt": "~0.4.0", + "phantomjs": "~1.9.1-0", + "grunt-recess": "~0.3", + "grunt-contrib-clean": "~0.4.0", + "grunt-contrib-copy": "~0.4.0", + "grunt-contrib-jshint": "~0.2.0", + "grunt-contrib-concat": "~0.1.3", + "grunt-contrib-uglify": "~0.1.1", + "grunt-html2js": "~0.1.0", + "grunt-contrib-watch": "~0.3.1", + "grunt-open": "~0.2.0", + "grunt-contrib-connect": "~0.3.0", + "grunt-karma": "~0.5", + "karma-chrome-launcher": "0.0.2", + "karma-script-launcher": "0.0.1", + "karma-firefox-launcher": "0.0.2", + "karma-jasmine": "0.0.1", + "karma-requirejs": "0.0.1", + "karma-coffee-preprocessor": "0.0.1", + "karma": "~0.9", + "karma-phantomjs-launcher": "0.0.2", + "grunt-ngdocs": "~0.1.2", + "grunt-ngmin": "0.0.3" + } +}