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-indexify

v0.1.1

Published

Robustly convert static html files into a form served without file extensions

Downloads

4

Readme

gulp-indexify

Master: Build Status

gulp-indexify makes Clean URLs by leveraging standard directory indexes.

convert any of:

  • http://site.com/about.html
  • http://site.com/about.php
  • http://site.com/about.aspx

into:

  • http://site.com/about/

by actually creating

  • http://site.com/about/index.html

and relying upon the standard directory index of most web servers. This makes it simpler to change server-side technologies in the future and is better for SEO.

example usage:

var gulp = require('gulp');
var indexify = require('gulp-indexify');

gulp
.task('indexify', function() {
  return gulp.src(['src/**/*.html'])
  .pipe(indexify())
  .pipe(gulp.dest('dest'))
  ;
})

Options

Options can be passed to gulp-indexify:

// ... code snippet from example
  return gulp.src(['src/**/*.html'])
  .pipe(indexify({
    fileExtension: ['.php','.html'],
    rewriteRelativeUrls: true
  }))
  .pipe(gulp.dest('dest'))
  ;
// ... code snippet from example

fileExtension:

Accepts a string or array of strings representing the file extension(s) for the files to rename. When renaming, the file extension is preserved, just the base file name is changed to index. Note that the dot for the file extension must be included. Default: .html

Example:

fileExtension: '.about.aspx'

changes about.aspx into about/index.aspx. But ignores map.html

rewriteRelativeUrls:

Since we are moving the HTML pages down a level in the path, relative URLs in the HTML will need to be rewritten. When this option is set to true that rewriting is done by gulp-indexify. Default: true

Example:

When renaming about.html to about/index.html

changes:

  <link rel="stylesheet" type="text/css" href="assets/style.css">

into:

  <link rel="stylesheet" type="text/css" href="../assets/style.css">

But leaves untouched/ignores:

  <!-- root relative URLs -->
  <link rel="stylesheet" type="text/css" href="/assets/default.css">

  <!-- absolute URLs -->
  <link rel="stylesheet" type="text/css"
    href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"
  >