view Gruntfile.js @ 224:d45450a0256a

Various changes/improvements: * Nicer init/deinit loop in Wiki class. * Renamed `wk cache` to `wk resolve`, made resolving pages a 1st class API on the Wiki class. * The `wk update` command now takes a path instead of an URL. * Re-implemented auto-updating pages when their file has changed. This added a new `isCacheValid` function on the DB layer. * Got rid of exceptions with some meta-properties being arrays and some not. Now they're all arrays, but there's some helper functions to work with that. * Remove trailing empty lines from multi-line meta-properties. * Fixed some issues parsing multi-line meta-properties and queries. * Fixed some issues resolving queries, especially with custom item templates. * Better handling of page/wiki permissions.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 10 Mar 2014 16:47:21 -0700
parents 825d05a9ee67
children 1c25cb99859f
line wrap: on
line source

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    less: {
      development: {
        options: {
          paths: ["wikked/assets"]
        },
        files: {
          "wikked/static/css/wikked.min.css": "wikked/assets/css/wikked.less"
        }
      },
      production: {
        options: {
          paths: ["wikked/assets"],
          compress: true
        },
        files: {
          "wikked/static/css/wikked.min.css": "wikked/assets/css/wikked.less"
        }
      }
    },
    requirejs: {
      development: {
        options: {
          optimize: "none",
          baseUrl: "wikked/assets",
          mainConfigFile: "wikked/assets/js/wikked.js",
          name: "js/wikked",
          out: "wikked/static/js/wikked.min.js"
        }
      },
      production: {
        options: {
          optimize: "uglify",
          baseUrl: "wikked/assets",
          mainConfigFile: "wikked/assets/js/wikked.js",
          name: "js/wikked",
          out: "wikked/static/js/wikked.min.js"
        }
      }
    },
    imagemin: {
      all: {
        files: [{
              expand: true,
              cwd: 'wikked/assets/',
              dest: 'wikked/static/',
              src: ['img/*.{png,jpg,gif}']
        }]
      }
    },
    copy: {
      development: {
        files: [
          {expand: true, cwd: 'wikked/assets/', dest: 'wikked/static/', src: ['img/**']},
          {expand: true, cwd: 'wikked/assets/', dest: 'wikked/static/', src: ['js/**']},
          {expand: true, cwd: 'wikked/assets/', dest: 'wikked/static/', src: ['tpl/**']},
          {expand: true, cwd: 'wikked/assets/', dest: 'wikked/static/', src: ['bootstrap/js/*.js']},
          {expand: true, cwd: 'wikked/assets/', dest: 'wikked/static/', src: ['bootstrap/fonts/**']}
        ]
      },
      dev_scripts: {
        files: [
          {expand: true, cwd: 'wikked/assets/', dest: 'wikked/static/', src: ['js/wikked.js', 'js/wikked/**']}
        ]
      },
      dev_templates: {
        files: [
          {expand: true, cwd: 'wikked/assets/', dest: 'wikked/static/', src: ['tpl/**']}
        ]
      },
      production: {
        files: [
          {expand: true, cwd: 'wikked/assets/', dest: 'wikked/static/', src: ['js/require.js']},
          {expand: true, cwd: 'wikked/assets/', dest: 'wikked/static/', src: ['bootstrap/fonts/**']}
        ]
      }
    },
    jshint: {
      all: ['wikked/assets/js/wikked.js', 'wikked/assets/js/wikked/**/*.js'],
      gruntfile: ['Gruntfile.js']
    },
    watch: {
      scripts: {
        files: ['wikked/assets/js/wikked.js', 'wikked/assets/js/wikked/**'],
        tasks: ['jshint:all', 'copy:dev_scripts']
      },
      templates: {
        files: ['wikked/assets/tpl/**/*.html'],
        tasks: ['copy:dev_templates']
      },
      styles: {
        files: ['wikked/assets/css/**/*.less'],
        tasks: ['less:development']
      },
      gruntfile: {
        files: ['Gruntfile.js'],
        tasks: ['jshint:gruntfile']
      }
    }
  });

  // Load plugins.
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-requirejs');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-imagemin');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');

  // Default task(s).
  grunt.registerTask('default', ['jshint', 'less:production', 'requirejs:production', 'imagemin:all', 'copy:production']);

  // Other tasks.
  grunt.registerTask('dev', ['less:development', 'copy:production', 'copy:development']);
};