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.
Yet another static site generator in NodeJS focussed on being fast and simple. Mangony fulfills just one task: It takes handlebars templates and compiles them to an output directory.
Yet another static site generator - fast, simple and powerful.
Mangony fulfills just one task: It takes handlebars templates and compiles them to an output directory.
Think of Assemble (grunt-assemble) with a smooth mango juice - yummy.
Install Mangony with
npm install mangony --save-dev
For the installation of the Grunt plugin, see grunt-mangony.
Just create a new instance of Mangony:
const app = new Mangony();
Then render your files or start your development server:
app.render();
When using the default options your files get compiled.
dev.js
Let`s say we want to develop a new app.
const Mangony = require(`mangony`);
const app = new Mangony({
allow: {
YFMLayout: false,
YFMContextData: false
},
compileStaticFiles: false
cwd: `src`,
dest: `dist/`,
devServer: {
start: true
},
watch: true,
types: {
data: {
dir: 'data',
files: [
'**/*.json',
'**/*.hjson'
]
},
partials: {
dir: 'partials',
files: [
'**/*.hbs'
]
},
pages: {
dir: 'pages',
files: [
'**/*.hbs',
'**/*.md'
]
},
layouts: {
dir: 'layouts',
files: [
'**/*.hbs'
]
}
},
helpers: [
'helpers/*.js'
]
});
app.render();
When using the devServer
options all routes get registered.
Now you can open your browser at localhost:3000
and navigate to the page you want to change.
The url is the path to your page without a file extension (i.e. /index
).
prod.js
Let`s say we want to build our app.
const Mangony = require(`mangony`);
const app = new Mangony({
allow: {
YFMLayout: false,
YFMContextData: false
},
cwd: `src`,
dest: `dist/`
types: {
data: {
dir: 'data',
files: [
'**/*.json',
'**/*.hjson'
]
},
partials: {
dir: 'partials',
files: [
'**/*.hbs'
]
},
pages: {
dir: 'pages',
files: [
'**/*.hbs',
'**/*.md'
]
},
layouts: {
dir: 'layouts',
files: [
'**/*.hbs'
]
}
},
helpers: [
'helpers/*.js'
]
});
app.render();
Now you can find the complete rendered output in the destination folder.
Boolean
)false
Add the possibility to reference layouts in YAML front matter. {{{yield}}}
will be replaced in your referenced layout with the content of the page.
Boolean
)false
Flag to add a specific data context for your page by referencing a data file id in YAML front matter.
"./"
Path to your assets in your destination directory.
[]
Add your own collections which can be used in YAML front matter.
true
Enable/disable the compiling of your files.
"src"
The current working directory.
"app"
Output directory.
null
You can pass your own Browser-Sync instance.
true
You can disable browser-sync.
null
You can pass your custom Browser-Sync options object.
null
You can pass your own express instance.
Set to false
if you want to disable the injection of the browser-sync script.
3000
Change the port of the development server.
false
Set to true
if you want to use the provided development server.
false
Set to true
if you want to use options.ext
in your routes.
false
Export the complete data stack as JSON file.
".html"
Define the extension of your output files.
false
Flatten your output directory.
["helpers/*.js"]
cwd
Register custom handlebars helpers by providing the path. Globbing is possible.
There are 4 necessary types which needs to be defined:
Each type has the following options:
For every type you can create deep ids. The whole path to the file will be used. That makes it possible to have multiple identical named data, partial, layout and page files in different folders.
"[type]"
cwd
You can change the type directory to any folder you like.
Important: for every type directory Mangony creates a watcher if options.watch
is true
.
["**/*.[typeExtension]"]
Pass an array of files to the files property. Globbing is possible.
"/"
By using deep ids the id is the path to your file. But using such ids in handlebars is not possible for your data files. That`s why you can define a path delimiter.
false
Just enable the internal watching of file changes.
Static site generator and server?
In general I love static site generators. Simply deploy the output and you`re done - great.
But there is one major problem. When developing every change leads to the compiling of all pages. In large projects this is very time consuming.
So why not just combine a server for development purpose with a static site generator?
Special thanks goes to Henri Podolski for the idea and discussion.
Assemble?
For 2 1/2 years I am working with Assemble. It is a great tool and I like it a lot.
The new Assemble (a full stack site generator) seems to be pretty nice, but it doesn`t fit so well in my current stack. Grunt-assemble however has a major bug, so it is not usable in the latest release.
Last but not least
I just wanted to develop a static site generator.
Just checkout the repository, install all dependencies with npm install
and execute npm test
.
When necessary an eco system for plugins will be integrated.
see LICENSE.md.
v1.1.12
FAQs
Yet another static site generator in NodeJS focussed on being fast and simple. Mangony fulfills just one task: It takes templates (like handlebars or jsx) and compiles them to an output directory.
The npm package mangony receives a total of 828 weekly downloads. As such, mangony popularity was classified as not popular.
We found that mangony demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.