add grunt.js build file (closes #235)

edit
Hakim El Hattab 2012-11-11 10:01:05 -05:00
parent 8e79f8592a
commit d6d0f40c5e
7 changed files with 150 additions and 124 deletions

View File

@ -285,12 +285,19 @@ Then:
3. Run ```node plugin/notes-server``` 3. Run ```node plugin/notes-server```
## Folder Structure ## Development Environment
reveal.js is built using the task-based command line build tool (grunt.js)[http://gruntjs.com]. Installation instructions here https://github.com/gruntjs/grunt#installing-grunt. With Node.js and grunt installed, you need to start by running ```npm install``` in the reveal.js root. When the dependencies have been installed you should run ```grunt watch``` to start monitoring files for changes.
If you want to customize reveal.js without running grunt.js you can alter the HTML to point to the uncompressed source files (css/reveal.css/js/reveal.js).
### Folder Structure
- **css/** Core styles without which the project does not function - **css/** Core styles without which the project does not function
- **js/** Like above but for JavaScript - **js/** Like above but for JavaScript
- **plugin/** Components that have been developed as extensions to reveal.js - **plugin/** Components that have been developed as extensions to reveal.js
- **lib/** All other third party assets (JavaScript, CSS, fonts) - **lib/** All other third party assets (JavaScript, CSS, fonts)
## License ## License
MIT licensed MIT licensed

7
css/reveal.min.css vendored 100644

File diff suppressed because one or more lines are too long

83
grunt.js 100644
View File

@ -0,0 +1,83 @@
/* global module:false */
module.exports = function(grunt) {
// Project configuration
grunt.initConfig({
pkg: '<json:package.json>',
inputJS: 'js/reveal.js',
inputCSS: 'css/reveal.css',
outputJS: 'js/reveal.min.js',
outputCSS: 'css/reveal.min.css',
meta: {
version: '2.2',
banner:
'/*!\n' +
' * reveal.js <%= meta.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
' * http://lab.hakim.se/reveal-js\n' +
' * MIT licensed\n' +
' *\n' +
' * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se\n' +
' */'
},
lint: {
files: [ 'grunt.js', '<%= inputJS %>' ]
},
// Tests will be added soon
qunit: {
files: [ 'test/**/*.html' ]
},
min: {
dist: {
src: [ '<banner:meta.banner>', '<%= inputJS %>' ],
dest: '<%= outputJS %>'
}
},
mincss: {
compress: {
files: {
'<%= outputCSS %>': [ '<%= inputCSS %>' ]
}
}
},
jshint: {
options: {
curly: false,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
eqnull: true,
browser: true,
expr: true
},
globals: {
head: false,
module: false
}
},
watch: {
files: [ 'grunt.js', '<%= inputJS %>', '<%= inputCSS %>' ],
tasks: 'default'
}
});
// Dependencies
grunt.loadNpmTasks( 'grunt-contrib-mincss' );
// Default task
grunt.registerTask( 'default', [ 'lint', 'mincss', 'min' ] );
};

View File

@ -12,7 +12,7 @@
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="stylesheet" href="css/reveal.css"> <link rel="stylesheet" href="css/reveal.min.css">
<link rel="stylesheet" href="css/theme/default.css" id="theme"> <link rel="stylesheet" href="css/theme/default.css" id="theme">
<!-- For syntax highlighting --> <!-- For syntax highlighting -->
@ -164,6 +164,7 @@
<a href="?theme=beige#/themes">Beige</a> - <a href="?theme=beige#/themes">Beige</a> -
<a href="?theme=simple#/themes">Simple</a> - <a href="?theme=simple#/themes">Simple</a> -
<a href="?theme=serif#/themes">Serif</a> - <a href="?theme=serif#/themes">Serif</a> -
<a href="?theme=night#/night">Night</a> -
<a href="?#/themes">Default</a> <a href="?#/themes">Default</a>
</p> </p>
<p> <p>

View File

@ -1,5 +1,5 @@
/*! /*!
* reveal.js 2.2 r45 * reveal.js
* http://lab.hakim.se/reveal-js * http://lab.hakim.se/reveal-js
* MIT licensed * MIT licensed
* *
@ -359,12 +359,12 @@ var Reveal = (function(){
} }
if ( config.controls && dom.controls ) { if ( config.controls && dom.controls ) {
dom.controlsLeft.forEach( function( el ) { el.addEventListener( 'click', preventAndForward( navigateLeft ), false ); } ); dom.controlsLeft.forEach( function( el ) { el.addEventListener( 'click', preventAndForward( navigateLeft ), false ); } );
dom.controlsRight.forEach( function( el ) { el.addEventListener( 'click', preventAndForward( navigateRight ), false ); } ); dom.controlsRight.forEach( function( el ) { el.addEventListener( 'click', preventAndForward( navigateRight ), false ); } );
dom.controlsUp.forEach( function( el ) { el.addEventListener( 'click', preventAndForward( navigateUp ), false ); } ); dom.controlsUp.forEach( function( el ) { el.addEventListener( 'click', preventAndForward( navigateUp ), false ); } );
dom.controlsDown.forEach( function( el ) { el.addEventListener( 'click', preventAndForward( navigateDown ), false ); } ); dom.controlsDown.forEach( function( el ) { el.addEventListener( 'click', preventAndForward( navigateDown ), false ); } );
dom.controlsPrev.forEach( function( el ) { el.addEventListener( 'click', preventAndForward( navigatePrev ), false ); } ); dom.controlsPrev.forEach( function( el ) { el.addEventListener( 'click', preventAndForward( navigatePrev ), false ); } );
dom.controlsNext.forEach( function( el ) { el.addEventListener( 'click', preventAndForward( navigateNext ), false ); } ); dom.controlsNext.forEach( function( el ) { el.addEventListener( 'click', preventAndForward( navigateNext ), false ); } );
} }
} }
@ -384,12 +384,12 @@ var Reveal = (function(){
} }
if ( config.controls && dom.controls ) { if ( config.controls && dom.controls ) {
dom.controlsLeft.forEach( function( el ) { el.removeEventListener( 'click', preventAndForward( navigateLeft ), false ); } ); dom.controlsLeft.forEach( function( el ) { el.removeEventListener( 'click', preventAndForward( navigateLeft ), false ); } );
dom.controlsRight.forEach( function( el ) { el.removeEventListener( 'click', preventAndForward( navigateRight ), false ); } ); dom.controlsRight.forEach( function( el ) { el.removeEventListener( 'click', preventAndForward( navigateRight ), false ); } );
dom.controlsUp.forEach( function( el ) { el.removeEventListener( 'click', preventAndForward( navigateUp ), false ); } ); dom.controlsUp.forEach( function( el ) { el.removeEventListener( 'click', preventAndForward( navigateUp ), false ); } );
dom.controlsDown.forEach( function( el ) { el.removeEventListener( 'click', preventAndForward( navigateDown ), false ); } ); dom.controlsDown.forEach( function( el ) { el.removeEventListener( 'click', preventAndForward( navigateDown ), false ); } );
dom.controlsPrev.forEach( function( el ) { el.removeEventListener( 'click', preventAndForward( navigatePrev ), false ); } ); dom.controlsPrev.forEach( function( el ) { el.removeEventListener( 'click', preventAndForward( navigatePrev ), false ); } );
dom.controlsNext.forEach( function( el ) { el.removeEventListener( 'click', preventAndForward( navigateNext ), false ); } ); dom.controlsNext.forEach( function( el ) { el.removeEventListener( 'click', preventAndForward( navigateNext ), false ); } );
} }
} }
@ -542,7 +542,7 @@ var Reveal = (function(){
*/ */
function getPreviousVerticalIndex( stack ) { function getPreviousVerticalIndex( stack ) {
if( stack && stack.classList.contains( 'stack' ) ) { if( stack && stack.classList.contains( 'stack' ) ) {
return parseInt( stack.getAttribute( 'data-previous-indexv' ) || 0 ); return parseInt( stack.getAttribute( 'data-previous-indexv' ) || 0, 10 );
} }
return 0; return 0;
@ -912,9 +912,9 @@ var Reveal = (function(){
// autoSlide value otherwise use the global configured time // autoSlide value otherwise use the global configured time
var slideAutoSlide = slides[index].getAttribute( 'data-autoslide' ); var slideAutoSlide = slides[index].getAttribute( 'data-autoslide' );
if( slideAutoSlide ) { if( slideAutoSlide ) {
autoSlide = parseInt( slideAutoSlide ); autoSlide = parseInt( slideAutoSlide, 10 );
} else { } else {
autoSlide = config.autoSlide autoSlide = config.autoSlide;
} }
} }
@ -950,17 +950,23 @@ var Reveal = (function(){
for( var j = 0; j < verticalSlides.length; j++ ) { for( var j = 0; j < verticalSlides.length; j++ ) {
// Stop as soon as we arrive at the present // Stop as soon as we arrive at the present
if( verticalSlides[j].classList.contains( 'present' ) ) break mainLoop; if( verticalSlides[j].classList.contains( 'present' ) ) {
break mainLoop;
}
pastCount++ pastCount++;
} }
// Stop as soon as we arrive at the present // Stop as soon as we arrive at the present
if( horizontalSlide.classList.contains( 'present' ) ) break; if( horizontalSlide.classList.contains( 'present' ) ) {
break;
}
// Don't count the wrapping section for vertical slides // Don't count the wrapping section for vertical slides
if( horizontalSlide.classList.contains( 'stack' ) === false ) pastCount++; if( horizontalSlide.classList.contains( 'stack' ) === false ) {
pastCount++;
}
} }
@ -987,14 +993,14 @@ var Reveal = (function(){
} ); } );
// Add the 'enabled' class to the available routes // Add the 'enabled' class to the available routes
if( routes.left ) dom.controlsLeft.forEach( function( el ) { el.classList.add( 'enabled' ); } ); if( routes.left ) dom.controlsLeft.forEach( function( el ) { el.classList.add( 'enabled' ); } );
if( routes.right ) dom.controlsRight.forEach( function( el ) { el.classList.add( 'enabled' ); } ); if( routes.right ) dom.controlsRight.forEach( function( el ) { el.classList.add( 'enabled' ); } );
if( routes.up ) dom.controlsUp.forEach( function( el ) { el.classList.add( 'enabled' ); } ); if( routes.up ) dom.controlsUp.forEach( function( el ) { el.classList.add( 'enabled' ); } );
if( routes.down ) dom.controlsDown.forEach( function( el ) { el.classList.add( 'enabled' ); } ); if( routes.down ) dom.controlsDown.forEach( function( el ) { el.classList.add( 'enabled' ); } );
// Prev/next buttons // Prev/next buttons
if( routes.left || routes.up ) dom.controlsPrev.forEach( function( el ) { el.classList.add( 'enabled' ); } ); if( routes.left || routes.up ) dom.controlsPrev.forEach( function( el ) { el.classList.add( 'enabled' ); } );
if( routes.right || routes.down ) dom.controlsNext.forEach( function( el ) { el.classList.add( 'enabled' ); } ); if( routes.right || routes.down ) dom.controlsNext.forEach( function( el ) { el.classList.add( 'enabled' ); } );
} }
} }
@ -1268,7 +1274,7 @@ var Reveal = (function(){
// Check if there's a focused element that could be using // Check if there's a focused element that could be using
// the keyboard // the keyboard
var activeElement = document.activeElement; var activeElement = document.activeElement;
var hasFocus = !!( document.activeElement && ( document.activeElement.type || document.activeElement.href || document.activeElement.contentEditable !== 'inherit' ) ); var hasFocus = !!( document.activeElement && ( document.activeElement.type || document.activeElement.href || document.activeElement.contentEditable !== 'inherit' ) );
// Disregard the event if there's a focused element or a // Disregard the event if there's a focused element or a
// keyboard modifier key is present // keyboard modifier key is present
@ -1479,7 +1485,10 @@ var Reveal = (function(){
deactivateOverview(); deactivateOverview();
slide( parseInt( this.getAttribute( 'data-index-h' ) ), parseInt( this.getAttribute( 'data-index-v' ) ) ); var h = parseInt( event.target.getAttribute( 'data-index-h' ), 10 ),
v = parseInt( event.target.getAttribute( 'data-index-v' ), 10 );
slide( h, v );
} }
} }

92
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,13 @@
{ {
"author": "Hakim El Hattab",
"name": "reveal.js", "name": "reveal.js",
"description": "HTML5 Slideware with Presenter Notes", "version": "2.2.0",
"version": "1.5.0", "description": "The HTML Presentation Framework",
"homepage": "http://lab.hakim.se/reveal-js",
"author": {
"name": "Hakim El Hattab",
"email": "hakim.elhattab@gmail.com",
"web": "http://hakim.se"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/hakimel/reveal.js.git" "url": "git://github.com/hakimel/reveal.js.git"
@ -16,5 +21,7 @@
"socket.io" : "~0.9.6", "socket.io" : "~0.9.6",
"mustache" : "~0.4.0" "mustache" : "~0.4.0"
}, },
"devDependencies": {} "devDependencies": {
"grunt-contrib-mincss": "~0.3.2"
}
} }