Set up grunt to minify for production.
authorCameron Ball <cameron@getapproved.com.au>
Wed, 10 Dec 2014 07:02:57 +0000 (15:02 +0800)
committerCameron Ball <cameron@getapproved.com.au>
Wed, 10 Dec 2014 07:02:57 +0000 (15:02 +0800)
.gitignore
Gruntfile.js [new file with mode: 0644]
app/css/animations.css [moved from app/animations.css with 100% similarity]
app/css/divinelegy.css [moved from app/divinelegy.css with 98% similarity]
app/css/grid.css [moved from app/grid.css with 100% similarity]
app/css/reset.css [moved from app/reset.css with 100% similarity]
app/index.html
package.json

index 039d372..866bf0b 100644 (file)
@@ -9,3 +9,5 @@ npm-debug.log
 nbproject
 /app/components/config/*
 !/app/components/config/*.example
+dist
+.tmp
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644 (file)
index 0000000..0082746
--- /dev/null
@@ -0,0 +1,57 @@
+module.exports = function (grunt) {
+    grunt.initConfig({
+        pkg: grunt.file.readJSON('package.json'),
+        clean: ["dist", '.tmp'],
+        copy: {
+            main: {
+                expand: true,
+                cwd: 'app/',
+                src: ['**', '!js/**', '!lib/**', '!**/*.css'],
+                dest: 'dist/'
+            },
+            shims: {
+                expand: true,
+                cwd: 'app/lib/webshim/shims',
+                src: ['**'],
+                dest: 'dist/js/shims'
+            }
+        },
+        rev: {
+            files: {
+                src: ['dist/**/*.{js,css}', '!dist/js/shims/**']
+            }
+        },
+        useminPrepare: {
+            html: 'app/index.html'
+        },
+        usemin: {
+            html: ['dist/index.html']
+        },
+        uglify: {
+            options: {
+                report: 'min',
+                mangle: false
+            }
+        }
+    });
+    grunt.loadNpmTasks('grunt-contrib-clean');
+    grunt.loadNpmTasks('grunt-contrib-copy');
+    grunt.loadNpmTasks('grunt-contrib-concat');
+    grunt.loadNpmTasks('grunt-contrib-cssmin');
+    grunt.loadNpmTasks('grunt-contrib-uglify');
+    grunt.loadNpmTasks('grunt-rev');
+    grunt.loadNpmTasks('grunt-usemin');
+    // Tell Grunt what to do when we type "grunt" into the terminal
+    grunt.registerTask('default', [
+        'copy', 'useminPrepare', 'concat', 'uglify', 'cssmin', 'rev', 'usemin'
+    ]);
+};
similarity index 100%
rename from app/animations.css
rename to app/css/animations.css
similarity index 98%
rename from app/divinelegy.css
rename to app/css/divinelegy.css
index 933a211..e68424a 100644 (file)
@@ -13,7 +13,7 @@
 /* close commented backslash hack */
 
 body {
-    background: url('./images/background.png');
+    background: url('../images/background.png');
     background-color: #0C141C;
     background-repeat:repeat-x;
     background-position:top;
similarity index 100%
rename from app/grid.css
rename to app/css/grid.css
similarity index 100%
rename from app/reset.css
rename to app/css/reset.css
index bb6295d..20e0486 100644 (file)
@@ -6,15 +6,17 @@
         <title>DivinElegy - Rock 'n' Roll</title>
         
         <!-- Styles -->
-        <link rel="stylesheet" href="reset.css"/>
-        <link rel="stylesheet" href="grid.css"/>
-        <link rel="stylesheet" href="animations.css"/>
-        <link rel="stylesheet" href="divinelegy.css"/>
-        <!-- end -->
+        <!-- build:css css/divinelegy.min.css -->
+        <link rel="stylesheet" href="css/reset.css"/>
+        <link rel="stylesheet" href="css/grid.css"/>
+        <link rel="stylesheet" href="css/animations.css"/>
+        <link rel="stylesheet" href="css/divinelegy.css"/>
+        <!-- endbuild -->
         
         <!-- In production use:
         <script src="//ajax.googleapis.com/ajax/libs/angularjs/x.x.x/angular.min.js"></script>
         -->
+        <!-- build:js js/divinelegy.min.js -->
         <script src="bower_components/angular/angular.js"></script>
         <script src="bower_components/angular-route/angular-route.js"></script>
         <script src="bower_components/angular-file-upload/angular-file-upload.js"></script>
         <script src="pages/upload/upload.js"></script>
         <script src="pages/simfiles/simfiles.js"></script>
         <script src="pages/packs/packs.js"></script>
-        <!-- End -->
         
         <!-- good luck cameron -->
-        <script src="divinelegy.js"></script>  
+        <script src="divinelegy.js"></script>
+        <!-- endbuild -->
     </head>
     <body>
         <div class="container">
index 7ed7df3..d0b133a 100644 (file)
@@ -1,7 +1,7 @@
 {
   "name": "angular-seed",
   "private": true,
-  "version": "0.0.0",
+  "version": "1.0.0",
   "description": "A starter project for AngularJS",
   "repository": "https://github.com/angular/angular-seed",
   "license": "MIT",
     "http-server": "^0.6.1",
     "bower": "^1.3.1",
     "shelljs": "^0.2.6",
-    "karma-junit-reporter": "^0.2.2"
+    "karma-junit-reporter": "^0.2.2",
+    "grunt": "~0.4.1",
+    "grunt-contrib-concat": "~0.3.0",
+    "grunt-contrib-uglify": "~0.2.7",
+    "grunt-contrib-cssmin": "~0.7.0",
+    "grunt-usemin": "~2.0.2",
+    "grunt-contrib-copy": "~0.5.0",
+    "grunt-rev": "~0.1.0",
+    "grunt-contrib-clean": "~0.5.0"
   },
   "scripts": {
     "postinstall": "bower install",