Skip to content

Commit becccd2

Browse files
committed
better build and dev process using grunt
1 parent 2df241c commit becccd2

5 files changed

+44
-6
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.*.sw*
2+
node_modules

Gruntfile.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module.exports = function(grunt) {
2+
3+
grunt.initConfig({
4+
pkg: grunt.file.readJSON('package.json'),
5+
coffee: {
6+
compile: {
7+
files: {
8+
'lib/jquery.simpleslideview.js': 'src/jquery.simpleslideview.coffee'
9+
}
10+
}
11+
},
12+
uglify: {
13+
build: {
14+
src: 'lib/jquery.simpleslideview.js',
15+
dest: 'lib/jquery.simpleslideview.min.js'
16+
}
17+
},
18+
watch: {
19+
scripts: {
20+
files: ['src/jquery.simpleslideview.coffee'],
21+
tasks: ['coffee', 'uglify']
22+
}
23+
}
24+
});
25+
26+
grunt.loadNpmTasks('grunt-contrib-coffee');
27+
grunt.loadNpmTasks('grunt-contrib-uglify');
28+
grunt.loadNpmTasks('grunt-contrib-watch');
29+
30+
grunt.registerTask('default', ['coffee', 'uglify', 'watch']);
31+
32+
};

lib/jquery.simpleslideview.js

-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// Generated by CoffeeScript 1.6.2
21
(function() {
32
var $, SimpleSlideView, defaults, outerHeight, outerWidth, resetStyles;
43

@@ -34,7 +33,6 @@
3433

3534
resetStyles = function(el, styles) {
3635
var $el, reset, style, _i, _len;
37-
3836
$el = $(el);
3937
reset = {};
4038
for (_i = 0, _len = styles.length; _i < _len; _i++) {
@@ -71,15 +69,13 @@
7169

7270
SimpleSlideView.prototype.on = function() {
7371
var _this = this;
74-
7572
this.$container.addClass(this.options.classNames.container);
7673
this.$views.addClass(this.options.classNames.view);
7774
this.$activeView.addClass(this.options.classNames.activeView);
7875
this.$views.not(this.$activeView).css('display', 'none');
7976
if (this.options.dataAttrEvent != null) {
8077
this.$container.on(this.options.dataAttrEvent, '[data-' + this.options.dataAttr.push + ']', function(event) {
8178
var $el, target;
82-
8379
$el = $(event.currentTarget);
8480
target = $el.data(_this.options.dataAttr.push);
8581
if (!target.length) {
@@ -92,7 +88,6 @@
9288
});
9389
return this.$container.on(this.options.dataAttrEvent, '[data-' + this.options.dataAttr.pop + ']', function(event) {
9490
var $el, target;
95-
9691
$el = $(event.currentTarget);
9792
target = $el.data(_this.options.dataAttr.pop);
9893
if (!target.length) {
@@ -119,7 +114,6 @@
119114
SimpleSlideView.prototype.changeView = function(targetView, push) {
120115
var $bothViews, $targetView, animateHeight, animateHeightCallback, containerTop, containerWidth, inAnimProps, outAnimProps, resetProps, transformProp, translateAfter, translateBefore,
121116
_this = this;
122-
123117
this.$container.trigger(this.options.eventNames.viewChangeStart);
124118
$targetView = $(targetView);
125119
$bothViews = this.$activeView.add($targetView);

lib/jquery.simpleslideview.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "SimpleSlideView",
3+
"version": "1.0.0",
4+
"devDependencies": {
5+
"grunt": "~0.4.1",
6+
"grunt-contrib-uglify": "~0.2.0",
7+
"grunt-contrib-watch": "~0.4.4",
8+
"grunt-contrib-coffee": "~0.7.0"
9+
}
10+
}

0 commit comments

Comments
 (0)