123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- /* jshint node: true */
- module.exports = function(grunt) {
- "use strict";
- // Project configuration.
- grunt.initConfig({
- // Metadata.
- pkg: grunt.file.readJSON('package.json'),
- banner: '/*!\n' +
- ' * Validator v<%= pkg.version %> for Bootstrap 3, by @1000hz\n' +
- ' * Copyright <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
- ' * Licensed under <%= _.pluck(pkg.licenses, "url").join(", ") %>\n' +
- ' *\n' +
- ' * https://github.com/1000hz/bootstrap-validator\n' +
- ' */\n\n',
- // Task configuration.
- jshint: {
- options: {
- jshintrc: 'js/.jshintrc'
- },
- gruntfile: {
- src: 'Gruntfile.js'
- },
- src: {
- src: ['js/*.js']
- },
- test: {
- src: ['js/tests/unit/*.js']
- }
- },
- concat: {
- options: {
- banner: '<%= banner %>',
- stripBanners: true
- },
- dist: {
- src: ['js/validator.js'],
- dest: 'dist/validator.js'
- }
- },
- copy: {
- docs: {
- expand: true,
- cwd: './dist',
- src: '*',
- dest: 'docs/dist'
- }
- },
- uglify: {
- options: {
- banner: '<%= banner %>',
- report: 'min'
- },
- min: {
- src: ['js/validator.js'],
- dest: 'dist/validator.min.js'
- }
- },
- qunit: {
- options: {
- inject: 'js/tests/unit/phantom.js'
- },
- files: ['js/tests/*.html']
- },
- watch: {
- src: {
- files: '<%= jshint.src.src %>',
- tasks: ['jshint:src', 'qunit']
- },
- test: {
- files: '<%= jshint.test.src %>',
- tasks: ['jshint:test', 'qunit']
- }
- },
- jekyll: {
- docs: {}
- },
- validation: {
- options: {
- reset: true,
- relaxerror: [
- "Bad value X-UA-Compatible for attribute http-equiv on element meta.",
- "Element img is missing required attribute src."
- ]
- },
- files: {
- src: ["_gh_pages/**/*.html"]
- }
- }
- });
- // These plugins provide necessary tasks.
- grunt.loadNpmTasks('grunt-contrib-concat');
- grunt.loadNpmTasks('grunt-contrib-copy');
- grunt.loadNpmTasks('grunt-contrib-jshint');
- grunt.loadNpmTasks('grunt-contrib-qunit');
- grunt.loadNpmTasks('grunt-contrib-uglify');
- grunt.loadNpmTasks('grunt-contrib-watch');
- grunt.loadNpmTasks('grunt-jekyll');
- grunt.loadNpmTasks('grunt-html-validation');
- grunt.loadNpmTasks('grunt-sed');
- // Docs HTML validation task
- grunt.registerTask('validate-html', ['jekyll', 'validation']);
- // Test task.
- grunt.registerTask('test', ['jshint', 'qunit']);
- // Docs distribution task.
- grunt.registerTask('dist-docs', 'copy:docs');
- // Distribution task.
- grunt.registerTask('dist', ['concat', 'uglify', 'dist-docs']);
- // Default task.
- grunt.registerTask('default', ['test', 'dist']);
- // Version numbering task.
- // grunt change-version-number --oldver=A.B.C --newver=X.Y.Z
- // This can be overzealous, so its changes should always be manually reviewed!
- grunt.registerTask('change-version-number', ['sed']);
- };
|