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

Commit

Permalink
Merge pull request #14 from queckezz/rework
Browse files Browse the repository at this point in the history
rework
  • Loading branch information
ianstormtaylor committed Jan 30, 2014
2 parents fa1d102 + 7215212 commit e22c87c
Show file tree
Hide file tree
Showing 26 changed files with 849 additions and 437 deletions.
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;
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

0 comments on commit e22c87c

Please sign in to comment.