stack-element-ejs

0.0.5-b • Public • Published

Dynamic data for stack-elements via EJS

You can use it as follows:

<my-thingy>
  <p><?= state.someString ?></p>
</my-thingy>

<my-thingy>
  <ul>
    <? state.someArray.forEach(function(elem) { ?>
      <li><?= elem ?><li>
    <? }) ?>
  </ul>
</my-thingy>

You can also nest stack-elements within one another, just note that when performing iterations you will need to bind the iteratee in this way:

<my-thingy>
  <div>
    <? state.someArray.forEach(function(elem) { ?>
      <my-otherthingy bind="<?= elem ?>">
        <h1><?= elem ?></h1
        <h2>State can still be rendered too: </h2>
        <p><?= state.someThingInteresting ?></p>
      <my-otherthingy>
    <? }) ?>
  </div>
</my-thingy>

Testing

Run npm test to run the integration test. It will spawn a server on port 8083 and run a browser simulation powered by NightmareJS.
If the test run fails or doesn't exit cleanly the server probably won't end so use the following (Linux) command to kill it / test again:

kill `lsof -t -i:8083`; npm test

Readme

Keywords

Package Sidebar

Install

npm i stack-element-ejs

Weekly Downloads

1

Version

0.0.5-b

License

MIT

Last publish

Collaborators

  • drschwabe