Skip to content

Instantly share code, notes, and snippets.

@enyo
Created December 18, 2012 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enyo/4330464 to your computer and use it in GitHub Desktop.
Save enyo/4330464 to your computer and use it in GitHub Desktop.
{
"name": "boot",
"description": "Lisa's website",
"version": "0.0.1",
"private": true,
"dependencies": {
"enyo/opentip": "*",
"enyo/dropzone": "*"
},
"scripts": [
"index.js",
"lib/do-stuff.js",
"lib/foo-bar.js"
]
}
/
package.json
views/
[blabla]
node_modules/
[blabla]
public/
js/
component.json
components/
[all components are installed here.]
index.js
lib/
do-stuff.js
foo-bar.js
build/
build.js <- this file gets generated when you type `component build` and that's the file you include.
module.exports = {
alert: function() {
alert("hi");
}
};
<html>
<head>
<script src="js/buid/build.js"></script>
<script>
// executes the index.js file
// "boot" is the name you define in component.json. This could be anything.
require("boot");
</script>
</head>
<body>
</body>
</html>
require("dropzone"); // Activates all dropzones
require("opentip"); // Activates all opentips
var doStuff = require("./lib/do-stuff"); // Don't forget to add ./ at the beginning to tell component that it's local
doStuff.alert();
var fooBar = require("./lib/foo-bar");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment