Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
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.
To get rvc.min.js
you can:
//cdn.jsdelivr.net/ractive.rvc/latest/rvc.min.js
.$ bower i rvc
.$ git clone https://github.com/ractivejs/rvc.git
.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({ /* ... */ });
});
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.
MIT.
0.6.0
FAQs
RequireJS plugin to load and optimise Ractive components
We found that rvc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.