Last active
December 17, 2015 14:49
-
-
Save lukearmstrong/5627202 to your computer and use it in GitHub Desktop.
Trying to optimize all files loaded by app.js to app.min.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|- public/ | |
| |- js/ | |
| | |- app/ | |
| | | |- interactions.js | |
| | | |- main.js | |
| | | |- students.js | |
| | |- lib/ | |
| | | |- console.log.js | |
| | | |- jquery-1.9.1.js | |
| | | |- no-js.js | |
| | | |- require.js | |
| | | |- typeahead.js | |
| | |- app.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('app.js loaded'); | |
// Place third party dependencies in the lib folder | |
// | |
// Configure loading modules from the lib directory, | |
// except 'app' ones, | |
requirejs.config({ | |
"baseUrl": "js/lib", | |
"paths" : { | |
"app" : "../app", | |
"jquery": "jquery-1.9.1" | |
}, | |
"shim" : { | |
"no-js" : ["jquery"], | |
"typeahead": ["jquery"] | |
} | |
}); | |
// Load the main app module to start the app | |
requirejs(["app/main"]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(["console.log", "jquery", "no-js", "typeahead"], function($) { | |
console.log('app/main.js loaded'); | |
require([ | |
"app/interactions", | |
"app/students" | |
]); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// It is working in the browser, because in each file I have a console.log() | |
// Console Output: | |
lib/require.js loaded require.js:1 | |
app.js loaded app.js:1 | |
lib/console.log.js loaded console.log.js:24 | |
lib/jquery-1.9.1.js loaded jquery-1.9.1.js:1 | |
lib/no-js.js loaded no-js.js:1 | |
app/main.js loaded main.js:3 | |
app/interactions.js loaded interactions.js:1 | |
app/students.js loaded students.js:1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment