Skip to content

Commit

Permalink
Update implementers.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Oct 9, 2014
1 parent c21decf commit e0b6a90
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions implementers.md
Expand Up @@ -33,6 +33,8 @@ In particular, it has the `rcu.parse()` method, which transforms the HTML file i
template: {v:1,t:[ /* template goes here... */] },
css: 'p { color: red; }',
script: /* contents of the script tag go here */,
scriptStart: 100, /* start of <script> contents */
scriptEnd: 200, /* end of <script> contents */
modules: [ 'myLibrary' ]
}
```
Expand Down Expand Up @@ -89,7 +91,7 @@ Optionally, you can lint and minify CSS during transformation. (Future versions

## `<script>` tags

Any top-level `<script>` (or `<script type='text/javascript'>`) tags should be concatenated and executed once, to generate `component.exports` ([see here](https://github.com/ractivejs/component-spec/blob/master/authors.md#component)). When making components, `rcu.make()` handles this for you.
A top-level `<script>` (or `<script type='text/javascript'>`) tag should be executed once, to generate `component.exports` ([see here](https://github.com/ractivejs/component-spec/blob/master/authors.md#component)). When making components, `rcu.make()` handles this for you.

When transforming components, you need to ensure that when the code executes, it has access to the variables `component`, `require` and `Ractive`, where `component` is an empty object (`{}`), `require` is a function that returns an external dependency, and `Ractive` is, well, Ractive.

Expand All @@ -106,7 +108,7 @@ require = function ( id ) {
// We wrap the code in an IIFE so component authors
// can't bork anything up
(function ( component, require, Ractive ) {
/* content of script tags goes here */
/* content of <script> tag goes here */
}( component, require, Ractive ));

if ( typeof component.exports === 'object' ) {
Expand Down

0 comments on commit e0b6a90

Please sign in to comment.