![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Flexible template compiler. Compile all or some of your templates, even those in parallel sub-folders, to a location that may or may not yet exist.
Prefer your veg in some colour? asparagus pages
Template compile tool for NodeJS. Compile all or some of your templates, even those in parallel sub-folders, to a location that may or may not yet exist.
$ npm install asparagus -g
adds a binary to the path so you can run asparagus from the command line
$ asparagus /path/to/source/folder namespace=mytemplates format=camelcase
var asparagus = require('asparagus');
// A source parameter is required as the first argument to asparagus
asparagus(__dirname + '/views', {
dest: __dirname + '/public/templates',
format: 'camelcase',
namespace: 'partials',
basedir: __dirname + '/views/dev',
exclusive: 'includes'
});
Plays nice with Gulp too simply wrap the above in a gulp task, I.e.,
var gulp = require('gulp'),
asparagus = require('asparagus');
gulp.task('asparagus', function () {
asparagus(__dirname + '/views', {
dest: __dirname + '/public/templates',
format: 'camelcase',
namespace: 'partials',
basedir: __dirname + '/views/dev',
exclusive: 'includes'
});
Templates are added to the namespace by the function name corresponding to their filename. If you are using Jade, you'll need to include Jade Runtime in the browser.
window.partials = {
functionName: function () { ..... }
};
[dest] {String}
- The final intended destination of the compiled templates(s), defaults to the value of the source parameter.
[format] {String}
- The format of each compiled template function name in the namespace, defaults to 'underscore' delimited function names.
[namespace] {String}
- The namespace object on the `window` object that will store references to the compiled template functions, defaults to 'templates'.
[basedir] {String}
- allows for absolute include paths, defaults to the value of the source parameter.
[exclusive] {String}
- When set to an existing directory name in the source path, compiles files only from and to that directory name within source and dest paths.
The following example will compile all and only, the files in the folder named 'includes' within the path; __dirname + 'views/source'
.
The compiled functions will be assigned to a hash called 'partials' and attached to the window
object.
Each compiled template function within window.partials
will be identifiable by an id created from its original filename and formatted as per the format option, which in this case is 'camelcase'
So this;
views/
dev/
includes/
my-tmpl.jade
en/
includes/
my-tmpl.jade
Outputs;
public/
templates/
dev/
includes/
my-tmpl.js
en/
includes/
my-tmpl.js
And when one is loaded
<script src='templates/en/includes/my-tmpl.js'></script>
Gives you
window.partials = {
myTmpl: function () { ..... }
};
Any absolute include statements within any of the original templates will be appended to the basedir option, __dirname + '/views/dev'.
FAQs
Flexible template compiler. Compile all or some of your templates, even those in parallel sub-folders, to a location that may or may not yet exist.
The npm package asparagus receives a total of 1 weekly downloads. As such, asparagus popularity was classified as not popular.
We found that asparagus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.