Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

rework #14

Merged
merged 6 commits into from
Jan 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@

mocha = ./node_modules/.bin/mocha

test:
@$(mocha) \
--require assert \
--reporter spec \
--bail

example:
node example/builder
open example/index.html
cd examples/string/ && component install && cd -
node examples/string/builder
open examples/string/index.html

cd examples/template/ && component install && cd -
node examples/template/builder
open examples/template/index.html

.PHONY: example
.PHONY: test example
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,41 @@
Use the plugin during your build process:

```js
var fs = require('fs')
, Builder = require('component-builder')
, jade = require('component-jade');

var Builder = require('component-builder');
var write = require('fs').readFileSync;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small typo

var jade = require('component-jade');
var builder = new Builder(__dirname);

builder.use(jade);
builder
.use(Builder.commonjs('scripts'))
.use(Builder.concat('scripts'))

// Transpile jade templates to html strings.
.use(jade('templates', { string: true }))

.use(Builder.commonjs('templates'))
.use(Builder.concat('templates'))

builder.build(function(err, res){
.build(function(err, build) {
if (err) throw err;
fs.writeFileSync('build/build.js', res.require + res.js);
if (res.css) fs.writeFileSync('build/build.css', res.css);

var js = build.requirejs;
js += build.scripts;
js += build.templates;
js += build.aliases;
write(file, js);
});
```

And then require the files in your Javascript:

```js
var tip = require('tip')
, template = require('template');
var template = require('template.jade');
var tip = require('tip');
```

__Note:__ You need to add jade and the runtime yourself. For a full working example take a look at `./examples`.

# License

(The MIT License)
Expand All @@ -66,4 +79,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 changes: 0 additions & 12 deletions example/builder.js

This file was deleted.

4 changes: 0 additions & 4 deletions example/index.js

This file was deleted.

Loading