From ec24d45c3d7020b6c2dff5c54ba89982f13b1e57 Mon Sep 17 00:00:00 2001 From: FrDH Date: Wed, 9 Mar 2016 23:36:56 +0100 Subject: [PATCH] v1.8.0 --- .gitignore | 9 +++++- Guardfile | 11 ------- bower.json | 4 +-- dotdotdot.jquery.json | 2 +- gulpfile.js | 46 ++++++++++++++++++++++++++++ index.html | 4 +-- package.json | 6 ++-- src/{js => }/jquery.dotdotdot.js | 5 ++- src/{js => }/jquery.dotdotdot.min.js | 24 +++++++-------- src/jquery.dotdotdot.min.umd.js | 24 +++++++++++++++ 10 files changed, 100 insertions(+), 35 deletions(-) delete mode 100644 Guardfile create mode 100644 gulpfile.js rename src/{js => }/jquery.dotdotdot.js (94%) rename src/{js => }/jquery.dotdotdot.min.js (56%) create mode 100644 src/jquery.dotdotdot.min.umd.js diff --git a/.gitignore b/.gitignore index e4c80b9..6defad6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,9 @@ # Ignore Mac system files. -._* \ No newline at end of file +._* + +# Ignore sass-cache files. +*.sass-cache* +*.scssc + +# Ignore Gulp modules +node_modules \ No newline at end of file diff --git a/Guardfile b/Guardfile deleted file mode 100644 index ebd4f7e..0000000 --- a/Guardfile +++ /dev/null @@ -1,11 +0,0 @@ -# Guardfile for the jQuery dotdotdot plugin javascript files. -# This minifies the non-minified .js-file. - -# For some reason, uglify only seems to work if the input and output is the same file. -# Therefor, we need to copy the contents from the original file to the minified file (using concat) before it can be minified. -guard :concat, type: "js", files: %w(jquery.dotdotdot), input_dir: "src/js", output: "src/js/jquery.dotdotdot.min" - -# Minify the file -guard 'uglify', :destination_file => "src/js/jquery.dotdotdot.min.js" do - watch ('src/js/jquery.dotdotdot.min.js') -end \ No newline at end of file diff --git a/bower.json b/bower.json index d6388f6..5222a96 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "jQuery.dotdotdot", - "main": "src/js/jquery.dotdotdot.js", - "version": "1.7.5", + "main": "src/jquery.dotdotdot.min.umd.js", + "version": "1.8.0", "homepage": "http://dotdotdot.frebsite.nl/", "authors": [ "Fred Heusschen " diff --git a/dotdotdot.jquery.json b/dotdotdot.jquery.json index 0faed53..743012d 100644 --- a/dotdotdot.jquery.json +++ b/dotdotdot.jquery.json @@ -1,6 +1,6 @@ { "name": "dotdotdot", - "version": "1.7.5", + "version": "1.8.0", "title": "jQuery dotdotdot", "description": "A jQuery plugin for advanced cross-browser ellipsis on multiple line content.", "homepage": "http://dotdotdot.frebsite.nl", diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..a22ebec --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,46 @@ +// npm install gulp-uglify gulp-rename gulp-umd --save-dev + +var gulp = require( 'gulp' ), + uglify = require( 'gulp-uglify' ), + rename = require( 'gulp-rename' ), + umd = require( 'gulp-umd' ); + + + +// Default task 'gulp': Runs JS tasks +gulp.task( 'default', function() { + gulp.start( 'js' ); +}); + + + +// Watch task 'gulp watch': Starts a watch on JS tasks +gulp.task( 'watch', function() { + gulp.watch( 'src/*.js', [ 'js' ] ); +}); + + + +// JS task 'gulp js': Runs all JS tasks +gulp.task( 'js', function() { + return gulp.src( 'src/jquery.dotdotdot.js' ) +// .pipe( jshint('.jshintrc') ) +// .pipe( jshint.reporter( 'default' ) ) + .pipe( uglify({ preserveComments: 'license' }) ) + .pipe( rename({ suffix: '.min' }) ) + .pipe( gulp.dest( 'src' ) ) + .pipe( umd({ + dependencies: function() { return [ 'jQuery' ]; }, + exports: function() { return true; }, + namespace: sanitizeNamespaceForUmd + })) + .pipe( rename({ suffix: '.umd' }) ) + .pipe( gulp.dest( 'src' ) ); +}); + +function sanitizeNamespaceForUmd( file ) { + path = file.path.split( '\\' ).join( '/' ).split( '/' ); + path = path[ path.length - 1 ]; + return path.split( '.' ).join( '_' ); +} + diff --git a/index.html b/index.html index 427a284..fb9f666 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ dotdotdot, advanced cross-browser ellipsis for multiple line content. - +