rvc

WebJar for rvc

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.bower
Идентификатор

Идентификатор

rvc
Последняя версия

Последняя версия

0.4.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

rvc
WebJar for rvc
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/ractivejs/rvc

Скачать rvc

Имя Файла Размер
rvc-0.4.0.pom
rvc-0.4.0.jar 14 KB
rvc-0.4.0-sources.jar 22 bytes
rvc-0.4.0-javadoc.jar 22 bytes
Обзор

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.bower/rvc/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>rvc</artifactId>
    <version>0.4.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/rvc/
implementation 'org.webjars.bower:rvc:0.4.0'
// https://jarcasting.com/artifacts/org.webjars.bower/rvc/
implementation ("org.webjars.bower:rvc:0.4.0")
'org.webjars.bower:rvc:jar:0.4.0'
<dependency org="org.webjars.bower" name="rvc" rev="0.4.0">
  <artifact name="rvc" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='rvc', version='0.4.0')
)
libraryDependencies += "org.webjars.bower" % "rvc" % "0.4.0"
[org.webjars.bower/rvc "0.4.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

rvc.js

RequireJS supports loader plugins, which allow your AMD modules to specify dependencies that aren't AMD modules, by prefixing the path with the plugin name followed by !.

rvc is one such loader plugin, and it allows you to require component files.

If you're not sure what 'component files' are, have a read of this. If you're not familiar with RequireJS loader plugins, there's some documentation here.

Installation

To get rvc.min.js you can:

  • Use CDN: //cdn.jsdelivr.net/ractive.rvc/latest/rvc.min.js.
  • Use bower: $ bower i rvc.
  • Download the latest release.
  • Clone the repo: $ git clone https://github.com/ractivejs/rvc.git.

Usage

First, RequireJS needs to be able to find rvc.js and ractive.js. Either it should be in the root of your project (or whatever baseUrl is configured to be), or you'll need to set up the paths config (obviously, change the paths as appropriate):

require.config({
  paths: {
    ractive: 'lib/ractive',
    rvc: 'plugins/rvc'
  }
});

Once RequireJS is configured, you can import components like so:

// At the top-level of your app, e.g. inside your main.js file
require([ 'rvc!foo' ], function ( Foo ) {
  var ractive = new Foo({ /* ... */ });
});

// Inside a module
define([ 'rvc!foo' ], function ( Foo ) {
  var ractive = new Foo({ /* ... */ });
});

Note that the .html file extension is omitted - this is assumed.

Component paths work just like regular module paths, so they can be relative (rvc!../foo), or below an entry in the paths config:

require.config({
  paths: {
    ractive: 'lib/ractive',
    rvc: 'plugins/rvc',
    ui: 'path/to/ractive_components'
  }
});

require([ 'rvc!ui/foo' ], function ( Foo ) {
  var ractive = new Foo({ /* ... */ });
});

Optimisation

The great feature of RequireJS is that while you can develop your app without having to rebuild it every time you change a file, you can also bundle it into a single file for production using the optimiser.

In addition to this 'inlining' of your components, rvc will parse your templates so that no additional computation needs to happen in the browser.

Once your project is optimised, you don't need the plugin itself, so add rvc to the stubModules option:

// optimiser config
{
  paths: {
    ractive: 'lib/ractive',
    rvc: 'plugins/rvc'
  },
  stubModules: [ 'rvc' ]
}

Consult the documentation for more information on using the optimiser.

License

MIT.

org.webjars.bower

Ractive.js

Версии библиотеки

Версия
0.4.0