client/Gruntfile.js.tmp
changeset 291 8cafab7c4b18
parent 290 8a6eb26ac87f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/Gruntfile.js.tmp	Fri May 16 12:35:51 2014 +0200
@@ -0,0 +1,129 @@
+
+module.exports = function(grunt) {
+
+  'use strict';
+
+  var renkan_src = [
+      'js/main.js',
+      'js/models.js',
+      'js/defaults.js',
+      'js/i18n.js',
+      'js/full-json.js',
+      'js/ldtjson-bin.js',
+      'js/list-bin.js',
+      'js/wikipedia-bin.js',
+      'dist/js/paper-renderer.js'
+  ];
+
+  var renkan_banner = grunt.file.read('js/header.js').toString() +
+      '\n/*! <%= pkg.name %> - v<%= pkg.version %> - Copyright © IRI ' +
+      '<%= grunt.template.today("yyyy") %> */\n\n';
+
+  // Project configuration.
+  grunt.initConfig({
+    pkg: grunt.file.readJSON('package.json'),
+    requirejs: {
+      renderer: {
+        options: {
+          baseUrl: "js/",
+          name: "build-renderer",
+          out: "dist/js/paper-renderer.js",
+          optimize: "none",
+          beautify: true,
+          paths: {
+            requtils: "require-utils",
+            jquery: "empty:",
+            underscore: "empty:"
+          }
+        }
+      }
+    },
+    uglify: {
+      options: {
+        banner: renkan_banner,
+        sourceMap: true,
+        sourceMapIncludeSources: true
+      },
+      renkan: {
+        files : {
+          'dist/js/renkan.min.js' : renkan_src
+        }
+      }
+    },
+    concat: {
+      options: {
+        banner: renkan_banner
+      },
+      renkan: {
+        files : {
+          'dist/js/renkan.js' : renkan_src
+        }
+      }
+    },
+    clean: {
+      options: {
+        force: true
+      },
+      renderer: ["dist/js/paper-renderer.js"],
+      renkan: ["dist/"],
+    },
+    cssmin: {
+      options: {
+        banner: renkan_banner
+      },
+      renkan: {
+        expand: true,
+        cwd: 'css/',
+        src: ['*.css'],
+        dest: 'dist/css',
+        ext: '.min.css'
+      }
+    },
+    copy: {
+      renkan: {
+        files: [
+          {expand: true, cwd: '', src: ['img/*'], dest: 'dist/', filter: 'isFile'},
+          {expand: true, cwd: '', src: ['data/properties.json'], dest: 'dist/', filter: 'isFile'},
+          {expand: true, cwd: '', src: ['lib/**'], dest: 'dist/'}
+         ]
+       },
+       renkan_css: {
+         options: {
+           process: function (content, srcpath) {
+             return grunt.template.process(renkan_banner) + content;
+           }
+         },
+         files: [{expand: true, cwd: '', src: ['css/*'], dest: 'dist/', filter: 'isFile'}]
+       }
+    },
+    jshint: {
+      all: ['Gruntfile.js', 'js/**/*.js']
+    },
+    connect: {
+        server: {
+          options: {
+            port: 9001,
+            base: '.',
+            keepalive: true,
+            useAvailablePort: true,
+            debug: true
+          }
+        }
+    }
+  });
+
+  // Load the plugin that provides the "uglify" task.
+  grunt.loadNpmTasks('grunt-contrib-requirejs');
+  grunt.loadNpmTasks('grunt-contrib-uglify');
+  grunt.loadNpmTasks('grunt-contrib-concat');
+  grunt.loadNpmTasks('grunt-contrib-clean');
+  grunt.loadNpmTasks('grunt-contrib-cssmin');
+  grunt.loadNpmTasks('grunt-contrib-copy');
+  grunt.loadNpmTasks('grunt-contrib-jshint');
+  grunt.loadNpmTasks('grunt-contrib-connect');
+
+  // Default task(s).
+  grunt.registerTask('default', ['requirejs', 'concat', 'uglify', 'cssmin', 'copy', 'clean:renderer']);
+
+
+};