Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

refactor for latest component(1)

  • Loading branch information...
commit f269252a1954d01772c6ae591d4c947220bd1547 1 parent a836c84
@tj tj authored
View
2  .gitignore
@@ -1,3 +1,5 @@
node_modules
test/*.js
test/*.css
+build
+components
View
14 Makefile
@@ -1,8 +1,14 @@
-test/out.js: index.js overlay.css
- component build package.json test/out
+build: overlay.css index.js template.js components
+ @component build
+
+template.js: template.html
+ @component convert $<
+
+components:
+ @component install
clean:
- rm -f test/out.{js,css}
+ rm -fr build components
-.PHONY: clean
+.PHONY: clean
View
5 component.json
@@ -7,7 +7,6 @@
"component/emitter": "*",
"component/jquery": "*"
},
- "scripts": ["index.js"],
- "styles": ["overlay.css"],
- "templates": ["overlay.html"]
+ "scripts": ["index.js", "template.js"],
+ "styles": ["overlay.css"]
}
View
2  index.js
@@ -41,7 +41,7 @@ function Overlay(options) {
Emitter.call(this);
options = options || {};
this.closable = options.closable;
- this.el = o(render('overlay'));
+ this.el = o(require('./template'));
this.el.appendTo('body');
if (this.closable) this.el.click(this.hide.bind(this));
}
View
19 package.json
@@ -1,19 +0,0 @@
-{
- "name": "overlay-component",
- "description": "Page overlay component",
- "version": "0.0.2",
- "keywords": ["component", "overlay"],
- "dependencies": {
- "emitter-component": "*",
- "jquery-component": "*"
- },
- "component": {
- "styles": ["overlay.css"],
- "scripts": {
- "overlay": "index.js"
- },
- "templates": {
- "overlay": "overlay.html"
- }
- }
-}
View
0  overlay.html → template.html
File renamed without changes
View
1  template.js
@@ -0,0 +1 @@
+module.exports = '<div id="overlay" class="hide"></div>';
View
4 test/index.html
@@ -3,11 +3,11 @@
<head>
<title>Overlay</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <link rel="stylesheet" href="out.css" />
+ <link rel="stylesheet" href="../build/build.css" />
</head>
<body>
<title>Overlay</title>
- <script src="out.js"></script>
+ <script src="../build/build.js"></script>
<script>
var overlay = require('overlay');
Please sign in to comment.
Something went wrong with that request. Please try again.