Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

metalsmith-slug

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metalsmith-slug - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

10

lib/index.js

@@ -1,5 +0,3 @@

var slug = require('slug');
var slug = require('slug');
var minimatch = require('minimatch');
var join = require('path').join;
var isMatch = false;

@@ -24,4 +22,5 @@ module.exports = plugin;

return function (files, metalsmith, done) {
var dest = metalsmith.destination();
var src = metalsmith.source();
opts.patterns = opts.patterns || [src + '/**'];
var matchedFiles = Object.keys(files).filter(function (file) {

@@ -40,4 +39,1 @@ return matchGlobArray(file, opts.patterns);

function absPath (relative) {
return join(process.cwd(), relative);
}
{
"name": "metalsmith-slug",
"version": "0.0.1",
"version": "0.0.2",
"description": "slugify a property in metalsmith",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -5,2 +5,62 @@ # metalsmith slug

[Metalsmith](http://www.metalsmith.io/), based on a particular property.
Useful for generating links to pages.
Useful for generating links to pages based on, say, their title.
## Installation
npm install metalsmith-slug
## Usage
If you're not familiar with Metalsmith, check it out. It's a very versatile file
processor that can be used for static site generation, project scaffolding and
more.
### Metalsmith CLI
Add `metalsmith-slug` to your `metalsmith.json`.
```json
{
"plugins": {
"metalsmith-slug": {}
}
}
```
### Metalsmith JavaScript API
Add `metalsmith-slug` to your project and `.use()` it.
```js
var slug = require('metalsmith-slug');
metalsmith.use(slug());
```
## Options
**patterns** _[array]_: Glob patters of files to match. Uses
[minimatch](https://github.com/isaacs/minimatch).
```js
metalsmith.use(slug({
patterns: ['*.md', '*.rst'] // Deafults to metalsmith.source() directory
}));
```
**property** _'string'_: Property to generate the slug from.
```js
metalsmith.use(slug({
property: 'name' // Defaults to 'title'
}));
```
**slug options**: You can additionally use any of the options available to [node-slug](https://github.com/dodo/node-slug#options)
```js
metalsmith.use(slug({
replacement: '_', // Defaults to node-slug defaults
symbols: false
}));
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc