Browse Source

Add Grunt file

phuoc 12 years ago
parent
commit
13ff8c5c35
7 changed files with 481 additions and 2 deletions
  1. 2 1
      .gitignore
  2. 45 0
      Gruntfile.js
  3. 18 0
      README.md
  4. 390 0
      dist/js/bootstrapvalidate.js
  5. 11 0
      dist/js/bootstrapvalidate.min.js
  6. 14 0
      package.json
  7. 1 1
      src/js/bootstrapvalidate.js

+ 2 - 1
.gitignore

@@ -1 +1,2 @@
-.idea/*
+.idea/*
+node_modules/*

+ 45 - 0
Gruntfile.js

@@ -0,0 +1,45 @@
+module.exports = function(grunt) {
+    grunt.initConfig({
+        pkg: grunt.file.readJSON('package.json'),
+
+        buildDir: 'dist',
+
+        banner: [
+            '/**',
+            ' * BootstrapValidate v<%= pkg.version %> (<%= pkg.homepage %>)',
+            ' *',
+            ' * A jQuery plugin to validate form fields. Use with Bootstrap 3',
+            ' *',
+            ' * @author      Nguyen Huu Phuoc <phuoc@huuphuoc.me>',
+            ' * @copyright   (c) 2013 Nguyen Huu Phuoc',
+            ' * @license     MIT',
+            ' */\n\n'
+        ].join('\n'),
+
+        concat: {
+            options: {
+                separator: ';'
+            },
+            dist: {
+                src: ['src/js/bootstrapvalidate.js', 'src/js/validator/*.js'],
+                dest: '<%= buildDir %>/js/bootstrapvalidate.js'
+            }
+        },
+
+        uglify: {
+            options: {
+                banner: '<%= banner %>'
+            },
+            build: {
+                src: ['<%= buildDir %>/js/bootstrapvalidate.js'],
+                dest: '<%= buildDir %>/js/bootstrapvalidate.min.js'
+            }
+        }
+    });
+
+    grunt.registerTask('default', 'build');
+    grunt.registerTask('build', ['concat', 'uglify']);
+
+    grunt.loadNpmTasks('grunt-contrib-concat');
+    grunt.loadNpmTasks('grunt-contrib-uglify');
+};

+ 18 - 0
README.md

@@ -7,6 +7,24 @@ A jQuery plugin to validate form fields. Use with Bootstrap 3
 * [jQuery](http://jquery.com/)
 * [Bootstrap 3](http://getbootstrap.com/)
 
+## Build
+
+BootstrapValidate uses [grunt](http://gruntjs.com) to simplify building process.
+
+From the BootstrapValidate root directory, execute the following commands to install the dependent packages (the administrator permission might be required):
+
+```bash
+$ npm install grunt --save-dev
+$ npm install grunt-contrib-concat --save-dev
+$ npm install grunt-contrib-uglify --save-dev
+```
+
+Then, uses grunt to build:
+
+```bash
+$ grunt
+```
+
 ## Author
 
 Nguyen Huu Phuoc ([Email](mailto: phuoc@huuphuoc.me) / [Twitter](http://twitter.com/nghuuphuoc) / [Github](http://github.com/nghuuphuoc))

File diff suppressed because it is too large
+ 390 - 0
dist/js/bootstrapvalidate.js


File diff suppressed because it is too large
+ 11 - 0
dist/js/bootstrapvalidate.min.js


+ 14 - 0
package.json

@@ -0,0 +1,14 @@
+{
+  "name": "bootstrapvalidate",
+  "author": {
+    "name": "Nguyen Huu Phuoc <phuoc@huuphuoc.me>",
+    "url": "https://twitter.com/nghuuphuoc"
+  },
+  "homepage": "http://github.com/nghuuphuoc/bootstrapvalidate",
+  "devDependencies": {
+    "grunt": "~0.4.1",
+    "grunt-contrib-uglify": "~0.2.4",
+    "grunt-contrib-concat": "~0.3.0"
+  },
+  "version": "0.1.0"
+}

+ 1 - 1
src/js/bootstrapvalidate.js

@@ -1,5 +1,5 @@
 /**
- * BootstrapValidate v0.1.0 (https://github.com/nghuuphuoc/bootstrapvalidate)
+ * BootstrapValidate (https://github.com/nghuuphuoc/bootstrapvalidate)
  *
  * A jQuery plugin to validate form fields. Use with Bootstrap 3
  *