Skip to content

Commit

Permalink
introduce grunt to build dist version
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanebachelier committed Jan 29, 2014
1 parent b7a3d51 commit 847918a
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 110 deletions.
13 changes: 1 addition & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@

.DS_Store
node_modules

plugins/.DS_Store

plugins/.DS_Store

swiper-demos/css/.DS_Store

swiper-demos/.DS_Store

swiper-demos/js/.DS_Store

swiper-demos/js/.DS_Store
92 changes: 92 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
'use strict';

/*global require:true, module:false*/
module.exports = function(grunt) {
// show elapsed time at the end
require('time-grunt')(grunt);
// load all grunt tasks
require('load-grunt-tasks')(grunt);

var swiper = {
filename: 'idangerous.swiper'
};

// Project configuration.
grunt.initConfig({
swiper: swiper,
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*\n' +
' * <%= pkg.name %> <%= pkg.version %>\n' +
' * <%= pkg.description %>\n' +
' *\n' +
' * <%= pkg.homepage %>\n' +
' *\n' +
' * Copyright 2010-<%= grunt.template.today("yyyy") %>, <%= pkg.author %>\n' +
' * The iDangero.us\n' +
' * http://www.idangero.us/\n' +
' *\n' +
' * Licensed under <%= pkg.license.join(" & ") %>\n' +
' *\n' +
' * Released on: <%= grunt.template.today("mmmm d, yyyy") %>\n' +
'*/\n',
// Task configuration.
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
js: {
src: ['lib/<%= swiper.filename %>.js'],
dest: 'dist/<%= swiper.filename %>.js'
},
css:{
src: ['lib/<%= swiper.filename %>.css'],
dest: 'dist/<%= swiper.filename %>.css'
}
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: ['dist/<%= swiper.filename %>.js'],
dest: 'dist/<%= swiper.filename %>.min.js',
}
},
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
gruntfile: {
src: ['Gruntfile.js']
},
lib: {
src: ['lib/*.js']
},
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
lib: {
files: '<%= jshint.lib.src %>',
tasks: ['jshint:lib']
}
}
});

// Default task.
this.registerTask('default', 'build');

// Build a new version of the library
this.registerTask('build', 'Builds a distributable version of <%= pkg.name %>', [
'concat:js',
'concat:css',
//'jshint:all',
'uglify'
]);

};
2 changes: 0 additions & 2 deletions dist/README.md

This file was deleted.

15 changes: 7 additions & 8 deletions dist/idangerous.swiper.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
/*
* Swiper - Mobile Touch Slider CSS
* Swiper 2.4.2
* Mobile touch slider and framework with hardware accelerated transitions
*
* http://www.idangero.us/sliders/swiper
*
* Vladimir Kharlampidi, The iDangero.us
* http://www.idangero.us/
*
* Copyright 2012-2013, Vladimir Kharlampidi
* Copyright 2010-2014, Vladimir Kharlampidi
* The iDangero.us
* http://www.idangero.us
* http://www.idangero.us/
*
* Licensed under GPL & MIT
* Licensed under GPL, MIT
*
* Released on: January 28, 2014
*/

/* ===============================================================
Basic Swiper Styles
================================================================*/
Expand Down
16 changes: 9 additions & 7 deletions dist/idangerous.swiper.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
/*
* Swiper 2.4.2 - Mobile Touch Slider
* http://www.idangero.us/sliders/swiper/
* Swiper 2.4.2
* Mobile touch slider and framework with hardware accelerated transitions
*
* Copyright 2012-2013, Vladimir Kharlampidi
* http://www.idangero.us/sliders/swiper
*
* Copyright 2010-2014, Vladimir Kharlampidi
* The iDangero.us
* http://www.idangero.us/
*
* Licensed under GPL & MIT
* Licensed under GPL, MIT
*
* Updated on: January 19, 2014
* Released on: January 28, 2014
*/
var Swiper = function (selector, params) {
/*=========================
Expand Down Expand Up @@ -2252,8 +2254,8 @@ var Swiper = function (selector, params) {
_this.swipeTo(newIndex, 0, false);
}
//Fix For Positive Oversliding
else if (_this.activeIndex > _this.slides.length - params.slidesPerView*2) {
newIndex = -_this.slides.length + _this.activeIndex + _this.loopedSlides
else if ((params.slidesPerView == "auto" && _this.activeIndex >= _this.loopedSlides*2) || (_this.activeIndex > _this.slides.length - params.slidesPerView*2)) {
newIndex = -_this.slides.length + _this.activeIndex + _this.loopedSlides;
_this.swipeTo(newIndex, 0, false);
}
}
Expand Down
Loading

0 comments on commit 847918a

Please sign in to comment.