Browse Source

#431: Add built time

nghuuphuoc 11 years ago
parent
commit
5304f3fcbd
4 changed files with 39 additions and 26 deletions
  1. 1 0
      CHANGELOG.md
  2. 36 22
      Gruntfile.js
  3. 1 2
      dist/css/bootstrapValidator.min.css
  4. 1 2
      dist/js/bootstrapValidator.min.js

+ 1 - 0
CHANGELOG.md

@@ -44,6 +44,7 @@ __Improvements__
 * [#388](https://github.com/nghuuphuoc/bootstrapvalidator/issues/388): Allow to override the default options. Useful for using multiple forms in the same page
 * [#393](https://github.com/nghuuphuoc/bootstrapvalidator/pull/393): The [remote validator](http://bootstrapvalidator.com/validators/remote/) adds support for dynamic ```url``` and method type (GET/POST), thanks to [@ericnakagawa](https://github.com/ericnakagawa)
 * [#422](https://github.com/nghuuphuoc/bootstrapvalidator/issues/422): Exclude particular field by ```excluded``` option or ```data-bv-excluded``` attribute
+* [#431](https://github.com/nghuuphuoc/bootstrapvalidator/issues/431): Add built time to the build file
 
 __Bug Fixes__
 * [#288](https://github.com/nghuuphuoc/bootstrapvalidator/issues/288): Fix [date validator](http://bootstrapvalidator.com/validators/date/) issue on IE8

+ 36 - 22
Gruntfile.js

@@ -1,8 +1,16 @@
 module.exports = function(grunt) {
     grunt.initConfig({
+        // ---
+        // Variables
+        // ---
+
         pkg: grunt.file.readJSON('package.json'),
 
-        buildDir: 'dist',
+        dirs: {
+            src: 'src',
+            dist: 'dist',
+            test: 'test'
+        },
 
         banner: [
             '/**',
@@ -10,43 +18,49 @@ module.exports = function(grunt) {
             ' *',
             ' * <%= pkg.description %>',
             ' *',
-            ' * @version     v<%= pkg.version %>',
+            ' * @version     v<%= pkg.version %>, built on <%= grunt.template.today("yyyy-mm-dd h:MM:ss TT") %>',
             ' * @author      <%= pkg.author.url %>',
-            ' * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc',
+            ' * @copyright   (c) 2013 - <%= grunt.template.today("yyyy") %> Nguyen Huu Phuoc',
             ' * @license     MIT',
-            ' */\n\n'
+            ' */\n'
         ].join('\n'),
 
+        // ---
+        // Tasks
+        // ---
+
         copy: {
             main: {
                 files: [
-                    { cwd: 'src/css', src: '**', dest: '<%= buildDir %>/css', expand: true, flatten: true, filter: 'isFile' },
-                    { cwd: 'src/js/languages', src: '**', dest: '<%= buildDir %>/js/languages', expand: true, flatten: true, filter: 'isFile' }
+                    { cwd: '<%= dirs.src %>/css', src: '**', dest: '<%= dirs.dist %>/css', expand: true, flatten: true, filter: 'isFile' },
+                    { cwd: '<%= dirs.src %>/js/languages', src: '**', dest: '<%= dirs.dist %>/js/languages', expand: true, flatten: true, filter: 'isFile' }
                 ]
             }
         },
 
         cssmin: {
-            minify: { expand: true, cwd: 'src/css/', src: ['*.css'], dest: '<%= buildDir %>/css/', ext: '.min.css' },
+            minify: { expand: true, cwd: '<%= dirs.src %>/css/', src: ['*.css'], dest: '<%= dirs.dist %>/css/', ext: '.min.css' },
             add_banner: {
                 options: {
                     banner: '<%= banner %>'
                 },
                 files: {
-                    '<%= buildDir %>/css/bootstrapValidator.min.css': ['src/css/bootstrapValidator.css']
+                    '<%= dirs.dist %>/css/bootstrapValidator.min.css': ['<%= dirs.src %>/css/bootstrapValidator.css']
                 }
             }
         },
 
         concat: {
-            options: {
-                separator: ';',
-                stripBanners: true,
-                banner: '<%= banner %>'
-            },
-            dist: {
-                src: ['src/js/bootstrapValidator.js', 'src/js/validator/*.js'],
-                dest: '<%= buildDir %>/js/bootstrapValidator.js'
+            source: {
+                options: {
+                    separator: ';',
+                    stripBanners: true,
+                    banner: '<%= banner %>'
+                },
+                dist: {
+                    src: ['<%= dirs.src %>/js/bootstrapValidator.js', '<%= dirs.src %>/js/validator/*.js'],
+                    dest: '<%= dirs.dist %>/js/bootstrapValidator.js'
+                }
             }
         },
 
@@ -55,14 +69,14 @@ module.exports = function(grunt) {
                 banner: '<%= banner %>'
             },
             build: {
-                src: ['<%= buildDir %>/js/bootstrapValidator.js'],
-                dest: '<%= buildDir %>/js/bootstrapValidator.min.js'
+                src: ['<%= dirs.dist %>/js/bootstrapValidator.js'],
+                dest: '<%= dirs.dist %>/js/bootstrapValidator.min.js'
             }
         },
 
         jshint: {
             all: [
-                'src/js/**/*.js'
+                '<%= dirs.src %>/js/**/*.js'
             ],
             options: {
                 browser: true,
@@ -84,8 +98,8 @@ module.exports = function(grunt) {
         },
 
         watch: {
-            scripts: {
-                files: ['src/css/**', 'src/js/**'],
+            source: {
+                files: ['<%= dirs.src %>/css/**', '<%= dirs.src %>/js/**'],
                 tasks: ['build'],
                 options: {
                     spawn: false
@@ -95,7 +109,7 @@ module.exports = function(grunt) {
     });
 
     grunt.registerTask('default', 'build');
-    grunt.registerTask('build', ['copy', 'cssmin', 'concat', 'uglify']);
+    grunt.registerTask('build',   ['copy', 'cssmin', 'concat', 'uglify']);
 
     grunt.loadNpmTasks('grunt-contrib-concat');
     grunt.loadNpmTasks('grunt-contrib-copy');

+ 1 - 2
dist/css/bootstrapValidator.min.css

@@ -3,11 +3,10 @@
  *
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.0-dev
+ * @version     v0.5.0-dev, built on 2014-06-26 8:48:13 AM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT
  */
 
-
 .bv-form .help-block{margin-bottom:0}.bv-form .tooltip-inner{text-align:left}.nav-tabs li.bv-tab-success>a{color:#3c763d}.nav-tabs li.bv-tab-error>a{color:#a94442}

File diff suppressed because it is too large
+ 1 - 2
dist/js/bootstrapValidator.min.js