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

bloggify-paths

v1.0.0

Published

Helper library for maintaining the Bloggify paths in one place.

Downloads

7

Readme

bloggify-paths

Patreon PayPal AMA Version Downloads Get help on Codementor

Helper library for maintaining the Bloggify paths in one place.

:cloud: Installation

$ npm i --save bloggify-paths

:clipboard: Example

const BloggifyPaths = require("bloggify-paths");

const Bloggify = { /* The Bloggify instance */ };

// Create a new instance of BloggifyPaths
console.log(new BloggifyPaths("~/path/to/my/app", {
    paths: {
        // Override the default (bloggify.js) with a JSON path.
        config: "bloggify.json"
    }
}, Bloggify));
// BloggifyPaths {
//   root: '/home/.../path/to/my/app',
//   _: {},
//   _paths:
//    { bloggify: '/',
//      config: 'bloggify.json',
//      plugins: '/node_modules',
//      publicMain: '/!/bloggify/public/',
//      publicCore: '/!/bloggify/core/',
//      publicTheme: '/!/bloggify/theme/' },
//   bloggify: '/home/.../path/to/my/app/',
//   config: '/home/.../path/to/my/app/bloggify.json',
//   plugins: '/home/.../path/to/my/app/node_modules',
//   publicMain: '/home/.../path/to/my/app/!/bloggify/public/',
//   publicCore: '/home/.../path/to/my/app/!/bloggify/core/',
//   publicTheme: '/home/.../path/to/my/app/!/bloggify/theme/' }

:memo: Documentation

BloggifyPaths(root, options, bloggifyInstance)

Creates a new instance of BloggifyPaths.

The instance contains the following fields:

  • publicUrls: The url endpoints (accesible via HTTP)

    • core: The core public url.
    • main: The application public url.
    • theme: The theme public url.
    • root: The root public url.
  • public: The file system paths.

    • core: The path to the core public directory.
    • main: The application public directory.
    • theme: The theme public directory.
    • root: The root public directory.
  • _bundles: The relative bundle urls.

    • js: it takes the following value: /js/index.js
    • css: it takes the following value: /css/index.css
  • bundleUrls: The bundle urls.

    • js: The absolute url of the js bundle.
    • css: The absolute url of the css bundle.
  • bundlePaths: The bundle paths.

    • js: The absolute path of the js bundle.
    • css: The absolute path of the css bundle.
  • _publicPaths: An array of pairs of url endpoints and disk paths.

Params

  • String root: The path to the application's root.
  • Object options: The Bloggify options. The paths object will be merged with the following defaults:
  • bloggify (String): The bloggify directory (by default the root).
  • config (String): The configuration file path (default: /bloggify.js).
  • plugins (String): The path to the plugins directory (default: /node_modules)>
  • publicMain (String): The public main directory endpoint (default: "/!/bloggify/public/").
  • publicCore (String): The public core directory endpoint (default: "/!/bloggify/core/").
  • publicTheme (String): The public theme directory endpoint (default: "/!/bloggify/theme/").
  • Bloggify bloggifyInstance: The Bloggify instance.

Return

  • Object The BloggifyPaths instance.

initPublicPaths()

Initializes the path values (documented above).

getBundlePaths(name)

Get the bundle paths for a bundle name.

Params

  • String name: The bundle name (default: main).

Return

  • Object An object containing the following fields:

  • urls: The URL endpoints.

    • js (String): The JavaScript bundle url.
    • css (String): The CSS bundle url.
  • local: The local paths.

    • js (String): The JavaScript bundle local path.
    • css (String): The CSS bundle local path.

getPublicPaths()

Fetches the public paths of the app.

Return

  • Array The public paths.

getMainPublic(fromDisk)

Returns the path to the app's public directory/uri.

Params

  • Boolean fromDisk: Establishes the source of the public directory.

Return

  • String The public path.

getThemePublic(fromDisk)

Returns the path to the theme's public directory/uri.

Params

  • Boolean fromDisk: Establishes the source of the public directory.

Return

  • String The public path.

staticFilePath(filePath, absolute)

Gets the url of a file.

Params

  • String filePath: The file path.
  • Boolean absolute: If true, the absolute path will be returned.

Return

  • String The file url.

prepare()

Initializes the paths values.

pluginPath(name)

Fetches the path of the plugin.

Params

  • String name: The plugin's name.

Return

  • type The plugin's path.

:yum: How to contribute

Have an idea? Found a bug? See how to contribute.

:moneybag: Donations

Another way to support the development of my open-source modules is to set up a recurring donation, via Patreon. :rocket:

PayPal donations are appreciated too! Each dollar helps.

Thanks! :heart:

:scroll: License

MIT © Ionică Bizău