Skip to content

Commit

Permalink
moved content to src
Browse files Browse the repository at this point in the history
- almond and requirejs as bower dependencies
- updated the build chain
- require(['peaks']) = window.peaks = require('peaks')
  • Loading branch information
thom4parisot committed Mar 10, 2014
1 parent 143a5d9 commit 9ad8b2d
Show file tree
Hide file tree
Showing 25 changed files with 32 additions and 488 deletions.
28 changes: 11 additions & 17 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,27 @@ module.exports = function(grunt) {
// JS Lint on all non-vendor files
jshint: {
all: [
'lib/js/**/*.js',
'!lib/js/almond.js',
'!lib/js/vendor/*.js'
'src/**/*.js',
'!src/almond.js'
]
// lib_test: {
// src: ['lib/**/*.js', 'test/**/*.js']
// }
},

// r.js concatenation and minification of javascript
requirejs: {
compile: {
options: {
name: "almond",
baseUrl: "lib/js/",
include: ['main'],
mainConfigFile: "lib/js/main.js",
name: "bower_components/almond/almond",
baseUrl: '.',
include: ['peaks'],
out: "build/js/peaks.min.js",
optimize: "none",
paths: {
"waveform-data": "../../bower_components/waveform-data/dist/waveform-data.min",
"EventEmitter": "../../bower_components/eventEmitter/EventEmitter",
"m": "waveform_viewer"
"peaks": "src/main",
"waveform-data": "bower_components/waveform-data/dist/waveform-data.min",
"EventEmitter": "bower_components/eventEmitter/EventEmitter"
},
wrap: { // https://github.com/jrburke/almond#exporting-a-public-api
startFile: 'lib/js/frag/start.frag',
endFile: 'lib/js/frag/end.frag'
startFile: 'src/frag/start.frag',
endFile: 'src/frag/end.frag'
},
optimize: "uglify2",
uglify2: {
Expand Down Expand Up @@ -76,7 +70,7 @@ module.exports = function(grunt) {
livereload: 1337
},
js: {
files: ['lib/**/*.js']
files: ['src/*.js']
},
lib_test: {
files: '<%= jshint.lib_test.src %>',
Expand Down
4 changes: 4 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@
"KineticJS": "http://d3lp1msu2r81bx.cloudfront.net/kjs/js/lib/kinetic-v4.5.5.min.js",
"eventEmitter": "~4.2.1",
"waveform-data": "~1.1.1"
},
"devDependencies": {
"requirejs": "~2.1.11",
"almond": "~0.2.9"
}
}
6 changes: 3 additions & 3 deletions build/js/peaks.min.js

Large diffs are not rendered by default.

16 changes: 5 additions & 11 deletions demo_page_dev.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,18 @@

<script type="text/javascript">
var require = {
baseUrl: "lib/js/",
paths: {
"waveform-data": "/bower_components/waveform-data/dist/waveform-data.min",
"EventEmitter": "/bower_components/eventEmitter/EventEmitter"
"peaks": "src/main",
"waveform-data": "bower_components/waveform-data/dist/waveform-data.min",
"EventEmitter": "bower_components/eventEmitter/EventEmitter"
}
};
</script>

<script main="lib/js/main" src="lib/vendor/require.js"></script>
<script src="bower_components/requirejs/require.js"></script>

<script>

document.addEventListener('DOMContentLoaded', function () {

require(['main'], function (Peaks) {
require(['peaks'], function (Peaks) {

var peaksInstance = Peaks.init({
container: document.getElementById('first-waveform-visualiser-container'),
Expand Down Expand Up @@ -99,9 +96,6 @@
});

});

});

</script>

<style>
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function (config) {
{ pattern: 'bower_components/waveform-data/dist/*.js', included: false },
{ pattern: 'bower_components/KineticJS/*.js', included: false },
{ pattern: 'test/*.html' },
{ pattern: 'lib/js/**/*.js', included: false },
{ pattern: 'src/**/*.js', included: false },
{ pattern: 'test/unit/**/*.js', included: false },
{ pattern: 'test_data/sample.*', included: false, served: true },
'test/test-main.js'
Expand Down
Loading

0 comments on commit 9ad8b2d

Please sign in to comment.