项目作者: lgabeskiria

项目描述 :
Aurelia plugin that will cleanup your bindings.
高级语言: JavaScript
项目地址: git://github.com/lgabeskiria/aurelia-clean-bindings.git
创建时间: 2016-07-06T11:39:35Z
项目社区:https://github.com/lgabeskiria/aurelia-clean-bindings

开源协议:Other

下载


aurelia-clean-bindigs

This plugin will clean up your bindings:

  1. <template>
  2. <input type="text" value.bind="value" change.trigger="onChange($event)">
  3. <label css="color: ${value}">${value}</label>
  4. <div custom-attribute="color.bind: squareColor; side-length.bind: squareSize"></div>
  5. </template>

After compilation this view becomes:

  1. <template>
  2. <input type="text" class="au-target" au-target-id="...">
  3. <label class="au-target" au-target-id="...">...</label>
  4. <div class="au-target" au-target-id="..."></div>
  5. </template>

After ViewFactory creates view it becomes:

  1. <template>
  2. <input type="text">
  3. <label>...</label>
  4. <div></div>
  5. </template>

Building The Code

To build the code, follow these steps.

  1. Ensure that NodeJS is installed. This provides the platform on which the build tooling runs.
  2. From the project folder, execute the following command:

    1. npm install
  3. Ensure that Gulp is installed. If you need to install it, use the following command:

    1. npm install -g gulp
  4. To build the code, you can now run:

    1. gulp build
  5. You will find the compiled code in the dist folder, available in three module formats: AMD, CommonJS and ES6.

  6. See gulpfile.js for other tasks related to generating the docs and linting.

How to install this plugin?

  1. In your project install the plugin via jspm with following command

    1. jspm install npm:aurelia-clean-bindings
  2. Make sure you use manual bootstrapping. In order to do so open your index.html and locate the element with the attribute aurelia-app. Change it to look like this:

    1. <body aurelia-app="main">
    2. ...
  3. Create (if you haven’t already) a file main.js in your src folder with following content:
  1. export function configure(aurelia) {
  2. aurelia.use
  3. .standardConfiguration()
  4. .developmentLogging()
  5. .plugin('aurelia-clean-bindings');
  6. aurelia.start().then(a => a.setRoot());
  7. }