Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
assemble-core
Advanced tools
The core assemble application with no presets or defaults. All configuration is left to the implementor.
The core assemble application with no presets or defaults. All configuration is left to the implementor.
This library, assemble-core, was designed to give implementors and hackers the baseline features and API for creating rich and powerful node.js applications. Learn more about what you can do with assemble-core.
Install with npm
$ npm i assemble-core --save
var assemble = require('assemble-core');
var app = assemble();
view collections
Create a custom view collection:
var app = assemble();
app.create('pages');
Now you can add pages with app.page()
or app.pages()
:
app.page('home.hbs', {content: 'this is the home page!'});
render
Render a view:
var app = assemble();
app.create('pages');
app.page('foo', {content: 'Hi, my name is <%= name %>'})
.use(function (view) {
if (!view.contents) {
view.contents = fs.readFileSync(view.path);
}
})
.set('data.name', 'Brian')
.render(function (err, res) {
console.log(res.content);
//=> 'Hi, my name is Brian'
});
Create an assemble
application. This is the main function exported by the assemble module.
Params
options
{Object}: Optionally pass default options to use.Example
var assemble = require('assemble');
var app = assemble();
Assemble has an extensive API for working with templates and template collections. In fact, the entire API from the templates library is available on Assemble.
While we work on getting the assemble docs updated with these methods you can visit the templates library to learn more about the full range of features and options.
Assemble has the following methods for working with the file system:
Assemble v0.6.0 has full vinyl-fs support, so any gulp plugin should work with assemble.
Use one or more glob patterns or filepaths to specify source files.
Params
glob
{String|Array}: Glob patterns or file paths to source files.options
{Object}: Options or locals to merge into the context and/or pass to src
pluginsExample
app.src('src/*.hbs', {layout: 'default'});
Specify the destination to use for processed files.
Params
dest
{String|Function}: File path or custom renaming function.options
{Object}: Options and locals to pass to dest
pluginsExample
app.dest('dist/');
Copy files from A to B, where A
is any pattern that would be valid in app.src and B
is the destination directory.
Params
patterns
{String|Array}: One or more file paths or glob patterns for the source files to copy.dest
{String|Function}: Desination directory.returns
{Stream}: The stream is returned, so you can continue processing files if necessary.Example
app.copy('assets/**', 'dist/');
Glob patterns or paths for symlinks.
Params
glob
{String|Array}Example
app.symlink('src/**');
Assemble has the following methods for running tasks and controlling workflows:
Define a task. Tasks are functions that are stored on a tasks
object, allowing them to be called later by the build method. (the CLI calls build to run tasks)
Params
name
{String}: Task namefn
{Function}: function that is called when the task is run.Example
app.task('default', function() {
return app.src('templates/*.hbs')
.pipe(app.dest('dist/'));
});
Run one or more tasks.
Params
tasks
{Array|String}: Task name or array of task names.cb
{Function}: callback function that exposes err
Example
app.build(['foo', 'bar'], function(err) {
if (err) console.error('ERROR:', err);
});
Watch files, run one or more tasks when a watched file changes.
Params
glob
{String|Array}: Filepaths or glob patterns.tasks
{Array}: Task(s) to watch.Example
app.task('watch', function() {
app.watch('docs/*.md', ['docs']);
});
What can I do with it?
You can use assemble-core to create your own custom:
Assemble is built on top of these great projects:
Install dev dependencies:
$ npm i -d && npm test
As of November 02, 2015:
Statements : 100% (38/38)
Branches : 100% (8/8)
Functions : 100% (10/10)
Lines : 100% (38/38)
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
If Assemble doesn't do what you need, [please let us know][issue].
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on November 02, 2015.
FAQs
The core assemble application with no presets or defaults. All configuration is left to the implementor.
The npm package assemble-core receives a total of 23,768 weekly downloads. As such, assemble-core popularity was classified as popular.
We found that assemble-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.