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

i18n-squish

v1.0.1

Published

Watch and compile language files into single locales ready to be served to angular-translate using angular-translate-loader-url.

Downloads

2

Readme

i18n-squish

Watch and compile language files into single locales ready to be served to angular-translate using angular-translate-loader-url. Can be used with or without Express and optinally watches files using node-watch to recompile upon changes.

Usage

  1. Require the package with an Express app and optional parameters object: require('i18n-squish')(app, params).

Options

  1. dir (default: 'app/i18n'): the directory where all language files reside
  2. out (default: dir + '/_compiled'): the directory to output compiled locale files
  3. endpoint (default: '/api/lang'): the endpoint to create an Express GET route for fetching locales - this defaults to the angular-translate-loader-url default
  4. whitespace (default: 0): number of spaces to use as whitespace in JSON.stringify call
  5. watch (default: false): boolean indicating whether uncompiled langauge files in dir should be watched and recompiled upon changes
  6. express (default: false): boolean indicating whether the module should create the Express endpoint defined by endpoint

All language files should be named after their respective locale. A language files filepath denotes the property names which will lead to it in the compiled locale file. For example, if a language file exists at /app/i18n/routes/login/en.json, the compiled JSON file en.json will contain routes.login.

Example

Given the following file structure and default options:

/app/i18n
|
└─ /branding
     |
     └─en.json
     └─ fr.json
└─ /routes
     |
     └─ en.json
     └─ fr.json

Compiled files will be created as follows:

/app/i18n
|
└─ ... 
└─ /_compiled
     |
     └─ en.json
     └─ fr.json

Using express: true and default endpoint: '/api/lang' options will mean retrieving the en.json file is as simple as sending a GET request to /api/lang?lang=json. This operation is performed automatically by angular-translate-loader-url when using $translateProvider.useUrlLoader('/api/lang').