Browse Source

Compiling the js with grunt.

pull/214/head
connors 11 years ago
parent
commit
a5246480e6
  1. 28
      Gruntfile.js
  2. 84
      dist/ratchet.js
  3. 3
      package.json

28
Gruntfile.js

@ -6,7 +6,7 @@ module.exports = function(grunt) {
// Metadata.
meta: {
srcPath: 'lib/sass/',
srcPath: 'lib/',
distPath: 'dist/'
},
@ -19,7 +19,23 @@ module.exports = function(grunt) {
'* Designed and built by @connors, @dhg, and @fat.\n' +
'* =====================================================\n' +
'*/\n',
concat: {
options: {
banner: '<%= banner %><%= jqueryCheck %>'
},
ratchet: {
src: [
'<%= meta.srcPath %>js/modals.js',
'<%= meta.srcPath %>js/popover.js',
'<%= meta.srcPath %>js/push.js',
'<%= meta.srcPath %>js/segmented-controllers.js',
'<%= meta.srcPath %>js/sliders.js',
'<%= meta.srcPath %>js/toggles.js'
],
dest: '<%= meta.distPath %><%= pkg.name %>.js'
}
},
sass: {
options: {
@ -27,7 +43,7 @@ module.exports = function(grunt) {
},
dist: {
files: {
'<%= meta.distPath %>ratchet.css': '<%= meta.srcPath %>ratchet.scss'
'<%= meta.distPath %><%= pkg.name %>.css': '<%= meta.srcPath %>sass/ratchet.scss'
}
}
},
@ -43,12 +59,12 @@ module.exports = function(grunt) {
});
// Load the plugin that provides the "uglify" task.
//grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
// Default task(s).
//grunt.registerTask('default', ['uglify']);
grunt.registerTask('default', ['sass']);
grunt.registerTask('default', ['sass', 'concat']);
grunt.registerTask('build', ['sass', 'concat']);
};

84
dist/ratchet.js vendored

@ -1,11 +1,12 @@
/**
* ==================================
* Ratchet v1.0.2
* Licensed under The MIT License
* http://opensource.org/licenses/MIT
* ==================================
*/
/*
* =====================================================
* Ratchet v2.0.0
* Copyright 2013 Connor Sears, Dave Gamache, and Jacob Thornton
* Licensed under http://www.opensource.org/licenses/MIT
*
* Designed and built by @connors, @dhg, and @fat.
* =====================================================
*/
/* ----------------------------------
* MODAL v1.0.0
* Licensed under The MIT License
@ -30,68 +31,6 @@
var modal = getModal(event);
if (modal) modal.classList.toggle('active');
});
}();/* ----------------------------------
* POPOVER v1.0.0
* Licensed under The MIT License
* http://opensource.org/licenses/MIT
* ---------------------------------- */
!function () {
var popover;
var findPopovers = function (target) {
var i, popovers = document.querySelectorAll('a');
for (; target && target !== document; target = target.parentNode) {
for (i = popovers.length; i--;) { if (popovers[i] === target) return target; }
}
};
var onPopoverHidden = function () {
document.body.removeChild(backdrop);
popover.style.display = 'none';
popover.removeEventListener('webkitTransitionEnd', onPopoverHidden);
}
var backdrop = function () {
var element = document.createElement('div');
element.classList.add('backdrop');
element.addEventListener('touchend', function () {
popover.addEventListener('webkitTransitionEnd', onPopoverHidden);
popover.classList.remove('visible');
});
return element;
}();
var getPopover = function (e) {
var anchor = findPopovers(e.target);
if (!anchor || !anchor.hash) return;
popover = document.querySelector(anchor.hash);
if (!popover || !popover.classList.contains('popover')) return;
return popover;
}
window.addEventListener('touchend', function (e) {
var popover = getPopover(e);
if (!popover) return;
popover.style.display = 'block';
popover.offsetHeight;
popover.classList.add('visible');
popover.parentNode.appendChild(backdrop);
});
window.addEventListener('click', function (e) { if (getPopover(e)) e.preventDefault(); });
}();
/* ----------------------------------
* PUSH v1.0.0
@ -511,6 +450,7 @@
window.addEventListener('popstate', popstate);
}();
/* ----------------------------------
* TABS v1.0.0
* Licensed under The MIT License
@ -557,7 +497,8 @@
});
window.addEventListener('click', function (e) { if (getTarget(e.target)) e.preventDefault(); });
}();/* ----------------------------------
}();
/* ----------------------------------
* SLIDER v1.0.1
* Licensed under The MIT License
* Adapted from Brad Birdsall's swipe
@ -671,6 +612,7 @@
window.addEventListener('touchend', onTouchEnd);
}();
/* ----------------------------------
* TOGGLE v1.0.0
* Licensed under The MIT License

3
package.json

@ -8,7 +8,8 @@
"grunt-contrib-nodeunit": "~0.2.0",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-sass": "~0.5.0",
"grunt-contrib-watch": "~0.5.3"
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-concat": "~0.3.0"
},
"keywords": [
"ratchet",

Loading…
Cancel
Save