diff --git a/.gitignore b/.gitignore index 4ecc2a7a..f605c5fc 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ Thumbs.DB node_modules bower_components +build/* demo/dist/* diff --git a/.jshintrc b/.jshintrc index d656d3f7..fad0529f 100644 --- a/.jshintrc +++ b/.jshintrc @@ -12,6 +12,7 @@ "unused": true, "strict": false, "node": true, + "browser": true, "jquery": true, "globals": { "prettyPrint": false, diff --git a/Gruntfile.js b/Gruntfile.js index 4f3bcf89..30b47502 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -21,16 +21,28 @@ module.exports = function (grunt) { // Concat definitions concat: { - dist: { + jquery: { files: { - "dist/jquery.linkify.js": [ + "build/jquery.linkify.js": [ "src/linkified.js", "src/jquery.linkify.js" ] } - }, - options: { - banner: "<%= meta.banner %>" + } + }, + + // Wrap files + wrap: { + jquery: { + expand: true, + src: ['build/jquery.linkify.js'], + dest: 'build/', + options: { + wrapper: [ + '<%= meta.banner %>\n;(function ($, window, document, undefined) {\n"use strict";', + '})(jQuery, window, document)\n' + ] + } } }, @@ -44,7 +56,7 @@ module.exports = function (grunt) { // Minify definitions uglify: { - my_target: { + dist: { src: ["dist/jquery.linkify.js"], dest: "dist/jquery.linkify.min.js" }, @@ -54,7 +66,13 @@ module.exports = function (grunt) { }, copy: { - main: { + build: { + expand: true, + flatten: true, + src: "build/build/*", + dest: "dist/" + }, + demo: { src: "dist/*", dest: "demo/" }, @@ -93,21 +111,32 @@ module.exports = function (grunt) { }, clean: [ - ".grunt/grunt-gh-pages/gh-pages" + ".grunt/grunt-gh-pages/gh-pages", + "build/*" ] }); - grunt.loadNpmTasks("grunt-contrib-concat"); grunt.loadNpmTasks("grunt-contrib-copy"); + grunt.loadNpmTasks("grunt-contrib-concat"); grunt.loadNpmTasks("grunt-contrib-jshint"); grunt.loadNpmTasks("grunt-contrib-uglify"); grunt.loadNpmTasks("grunt-contrib-connect"); grunt.loadNpmTasks("grunt-contrib-clean"); + grunt.loadNpmTasks("grunt-wrap"); grunt.loadNpmTasks("grunt-gh-pages"); grunt.loadNpmTasks("grunt-bumper"); - grunt.registerTask("default", ["jshint", "concat", "uglify", "copy"]); + grunt.registerTask("default", [ + "jshint", + "concat", + "wrap", + "copy:build", + "uglify", + "copy:demo", + "clean" + ]); + grunt.registerTask("travis", ["jshint"]); grunt.registerTask("release", ["bumper", "clean"]); grunt.registerTask("release:minor", ["bumper:minor", "clean"]); diff --git a/bower.json b/bower.json index 8d88cf32..36a5be39 100644 --- a/bower.json +++ b/bower.json @@ -21,7 +21,7 @@ ], "license": "MIT", "dependencies": { - "jquery": ">= 1.9.0" + "jquery": "~1.10.2" }, "ignore": [ "**/.*", diff --git a/demo/index.html b/demo/index.html index 892b8f2b..da4b60c0 100644 --- a/demo/index.html +++ b/demo/index.html @@ -385,7 +385,7 @@