Skip to content

Commit

Permalink
Update guide.md
Browse files Browse the repository at this point in the history
  • Loading branch information
aMarCruz committed Feb 9, 2016
1 parent 9f2ff0e commit 9ea69b9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions doc/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ If there's no HTML tags within the root tag, riot assumes that the content is Ja
</my-tag>
```

This may seem counterintuitive, but complies with the riot specification for [untagged JavaScript blocks](the-untagged-javascript-block).
This may seem counterintuitive, but complies with the riot specification for [untagged JavaScript blocks](#the-untagged-javascript-block).


### Whitespace
Expand Down Expand Up @@ -265,7 +265,8 @@ The `src` attribute of the `script` tags inside a riot tag allows load source fi

The filename in `src` can be absolute or relative. If you pass a third parameter to the `compile` function with the full name of the file being compiled, relative paths will be resolved from this name, if not, these will be relative to the current working directory (as returned by `proccess.cwd()`).

JavaScript type defaults to the `type` specified in the options passed to the compiler. If you don't want the code to be parsed, use `type="none"`.
Without a `type=` directive, the JavaScript parser defaults to the `type` specified in the options passed to the compiler. If you don't want the code to be parsed, use `type="none"`.

If you just want to get the `script` tag rendered, keeping the `type`
attribute and the tag contents untouched, you should then use the `defer`
attribute.
Expand All @@ -286,8 +287,15 @@ Example:
```js
var compile = require('riot-compile'),
fs = require('fs')
var source = fs.readFileSync(full_filename, 'utf8')
var result = compiler.compile(source, options, full_filename)
var tagfile = 'src/mytag.tag',
outfile = 'js/mytag.js',
options = {}

fs.readFile(tagfile, function (err, source) {
if (err) throw err
var js = compiler.compile(source, options, tagfile)
fs.writeFile(outfile, js)
})
```

So, if you have a js/data.js loaded by a mytag.tag file...
Expand Down

0 comments on commit 9ea69b9

Please sign in to comment.