npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-html-anchor-rewriter

v1.0.2

Published

A plugin for editing anchor element in the HTML files.

Downloads

8

Readme

Html Anchor Rewriter Gulp Plugin

This is the simple plugin to re-write anchor elements such as adding new attributes.

Motivation

While developing another gulp plugin (1), I have needed re-writing anchor elements for the SEO. After reading some articles, I decided develop a gulp plugin for re-writing anchor elements.

HitCount GitHub npm Vulnerabilities Bugs Code Smells GitHub issues

Challenges

The gulp system has dynamic and usefull plugin system. However, some times finding a plugin will be a challenge and writing a custom plugin is already a challenge.

The gulp suggets a guideline for writing a plugin. This time, I want to follow it (2). In this challenge, I wrote tests for validating plugin and I have used Mocha and Chai.

"NodeJS" "MOCHA" "chai" "GitHub Actions" "SonarCloud"

Installation

npm install --save-dev gulp-html-anchor-rewriter

Usage

const { src, dest } = require("gulp");
const anchorRewriter = require("gulp-html-anchor-rewriter");

exports.default = function () {

    return src("./test/*.html")
        .pipe(anchorRewriter({
            "rel": "nofollow"
        }))
        .pipe(dest("./output"));
};

Options

Without any options plugin throws an exception.

| Name | Type | Description | |---|---|---| | keyword | string, string[] | For searching the anchor element href attribute value. If the href contains the keyword, the anchor will be processed. | | rel | string | For adding rel attribute. | | target | string | For adding target attribute. | | whiteList | boolean | Indicates whether the white-list mode is enabled. |

Testing

For local testing, can be used unit tests.

$> npm install
$> npm test

Support

For supporting me, you can add an issue for bug cases or new feature requests.