Skip to content

Commit

Permalink
updated build instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
kirbysayshi committed Sep 20, 2012
1 parent 24bc865 commit f80ee95
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 23 deletions.
11 changes: 8 additions & 3 deletions CONTRIBUTING.md
Expand Up @@ -11,8 +11,13 @@ Building Vash


Simple as: Simple as:


$ support/build.js build && node test/vash.test.js $ support/task build


If you need to test the minified, built version of `vash.js`: And tests (includes `build` task):

$ support/task test

If you need to test the minified version of `vash.js`:

$ support/task test --min


$ support/build.js build && node test/vash.test.js min
47 changes: 27 additions & 20 deletions README.md
Expand Up @@ -6,13 +6,13 @@ Here's a quick example:


// compile template // compile template
var itemTpl = vash.compile( '<li data-description="@desc.name">This is item number: @number.</li>' ); var itemTpl = vash.compile( '<li data-description="@desc.name">This is item number: @number.</li>' );

// generate using some data // generate using some data
var out = itemTpl({ desc: { name: 'templating functions seem to breed' }, number: 2 }); var out = itemTpl({ desc: { name: 'templating functions seem to breed' }, number: 2 });

// dump it // dump it
console.log( out ) console.log( out )

// outputs: // outputs:
<li data-description="templating functions seem to breed">This is item number: 2.</li> <li data-description="templating functions seem to breed">This is item number: 2.</li>


Expand Down Expand Up @@ -49,7 +49,14 @@ There are many more examples in the unit tests, located in `test/vash.test.js`.


# BUILD # BUILD


support/build.js build && node test/vash.test.js && node test/vash.test.js min support/tasks build
support/tasks test

OR:

support/tasks test

The `test` task builds before running tests.


Vash has a few builds for various purposes, found in the [build](vash/tree/master/build) folder. There are three primary use cases for Vash: Vash has a few builds for various purposes, found in the [build](vash/tree/master/build) folder. There are three primary use cases for Vash:


Expand All @@ -67,7 +74,7 @@ Given these use cases, there are a few different builds optimized:


### vash.compile(templateString, [options]) ### vash.compile(templateString, [options])


Vash has one public method, `vash.compile()`. It accepts a string template, and returns a function that, when executed, returns a generated string template. The compiled function accepts one parameter, `model`, which is the object that should be used to populate the template. Vash has one public method, `vash.compile()`. It accepts a string template, and returns a function that, when executed, returns a generated string template. The compiled function accepts one parameter, `model`, which is the object that should be used to populate the template.


`options` is an optional parameter that can be used to override the global `vash.config` for a single call to `compile`. `options` is an optional parameter that can be used to override the global `vash.config` for a single call to `compile`.


Expand Down Expand Up @@ -145,13 +152,13 @@ Again, rendering is the same regardless:
compiledTpl( { description: 'I am a banana!' } ); compiledTpl( { description: 'I am a banana!' } );
// outputs: // outputs:
// <li>I'm a banana!</li> // <li>I'm a banana!</li>

### vash.config.helpersName = "html" ### vash.config.helpersName = "html"


Determines the name of the internal variable through which registered helper methods can be reached. Example: Determines the name of the internal variable through which registered helper methods can be reached. Example:


<li>@html.raw(model.description)</li> <li>@html.raw(model.description)</li>

vs vs


// vash.config.helpersName == "help"; // vash.config.helpersName == "help";
Expand All @@ -162,7 +169,7 @@ Again, rendering is the same regardless:
compiledTpl( { description : '<strong>Raw</strong> content!' } ); compiledTpl( { description : '<strong>Raw</strong> content!' } );
// outputs: // outputs:
// <li><strong>Raw</strong> content!</li> // <li><strong>Raw</strong> content!</li>

### vash.config.debug = true/false(default) ### vash.config.debug = true/false(default)


Setting `vash.config.debug` to `true` will compile templates with extensive debugging information, so if an error is thrown while rendering a template, exact location (line, charater) information can be given. Setting `vash.config.debug` to `true` will compile templates with extensive debugging information, so if an error is thrown while rendering a template, exact location (line, charater) information can be given.
Expand All @@ -184,7 +191,7 @@ When Vash encounters text that directly follows and opening brace of a block, it
When `vash.config.favorText` is set to `true`, Vash will instead assume that most things are non-code (markup/text) unless it's very explicit. When `vash.config.favorText` is set to `true`, Vash will instead assume that most things are non-code (markup/text) unless it's very explicit.


@it.forEach(function(a){ @it.forEach(function(a){
var b = a; // vash.config.favorText assumes this line is content var b = a; // vash.config.favorText assumes this line is content
}) })


This option is __EXPERIMENTAL__, and should be treated as such. It allows Vash to be used in a context like [Markdown](http://daringfireball.net/projects/markdown/syntax), where HTML tags, which typically help Vash tell the difference between code and content, are rare. This option is __EXPERIMENTAL__, and should be treated as such. It allows Vash to be used in a context like [Markdown](http://daringfireball.net/projects/markdown/syntax), where HTML tags, which typically help Vash tell the difference between code and content, are rare.
Expand Down Expand Up @@ -251,13 +258,13 @@ As of v0.5.1, Vash now offers runtime view engine support in the style of Jade's
<title>@model.title</title> <title>@model.title</title>
<link rel="stylesheet" href="site.css" type="text/css" media="screen" charset="utf-8"> <link rel="stylesheet" href="site.css" type="text/css" media="screen" charset="utf-8">
</head> </head>
<body> <body>
<section> <section>
@html.block('content') @html.block('content')
</section> </section>


<footer> <footer>
@html.block('footer') @html.block('footer')
</footer> </footer>
</body> </body>
</html> </html>
Expand Down Expand Up @@ -308,9 +315,9 @@ Vash cannot do this:


# Current Test Results # Current Test Results


support/build.js build && node test/vash.test.js support/task test
······································································································ ······································································································
✓ OK » 102 honored (0.182s) ✓ OK » 102 honored (0.182s)


# Why Vash? # Why Vash?


Expand All @@ -323,10 +330,10 @@ The original name of this syntax is Razor, implying that it is as stripped down
> WK.tpl() > WK.tpl()
> japanese emoticons? > japanese emoticons?
> _$8 is a valid JS identifier > _$8 is a valid JS identifier
> mootools has $$ > mootools has $$
> double dollars > double dollars
> the 60 billion double dollar man > the 60 billion double dollar man
> Vash the Stampede! > Vash the Stampede!
> vash.tpl() > vash.tpl()
> Very Awesome Scripted HTML > Very Awesome Scripted HTML
> ...maybe just vash > ...maybe just vash
Expand Down

0 comments on commit f80ee95

Please sign in to comment.