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

@texastribune/queso-tools

v3.0.0

Published

Node task runners for common front-end tasks

Downloads

123

Readme

@texastribune/queso-tools

Node task runners for compiling CSS, creating SVGs, and more.

This repo accompanies our CSS+icons framework, queso-ui. Use the the task runners here, to compile the assets in that framework.

Install

npm install @texastribune/queso-tools --save-dev

or

yarn add @texastribune/queso-tools --dev

Tools

| modules | params | | ----------- | ----------| | styles | dirs, manifest (manifest is optional if you want files with hashed names)| | icons | dirs | | copy | dirs |

Using these tasks in the wild

Most of the tasks expect an array of directories or files with an input, in: key, and output, out: key. To set this up, create a file called paths.js and declare your map of paths.

Example:

// paths.js
const SCSS_DIR = './scss';
const CSS_OUTPUT_DIR = './css/';
const SVG_LIB_DIR = './node_modules/@texastribune/queso-ui/icons/base';
const SVG_OUTPUT_DIR = './templates/includes';

const CSS_MAP = [
  {
    in: `${SCSS_DIR}/styles.scss`,
    out: CSS_OUTPUT_DIR,
  },
  {
    in: `${SCSS_DIR}/styles2.scss`,
    out: CSS_OUTPUT_DIR,
  },
];
// The "in" key for icons should be an array; you can mix and match icons from @texastribune/queso-ui and some stored locally
const SVG_MAP = [
  {
    in: [
      `${SVG_LIB_DIR}/twitter.svg`,
      `${SVG_LIB_DIR}/facebook.svg`,
      './icons/custom-icon.svg',
      './icons/other-icon.svg'
    ],
    out: `${SVG_OUTPUT_DIR}/my-svg-sprite.html`,
  },
];

// copy contents of a directory into another directory
// and/or copy a directory/file into another-directory/file
const COPY_MAP = [
  {
    in: SVG_LIB_DIR,
    out: SVG_OUTPUT_DIR,
  },
  {
    in: `${SVG_LIB_DIR}/twitter.svg`,
    out: `${SVG_OUTPUT_DIR}/twitter.svg`,
  },
];
// use if you'd like the outputted CSS to have hashed file names
const MANIFEST_FILE = `${CSS_OUTPUT_DIR}styles.json`;


module.exports = {
  CSS_MAP,
  SVG_MAP,
  MANIFEST_FILE,
  COPY_MAP
};

Now create a build.js file in that same folder where you'll reference these paths and begin to call the various tasks in this package.

That could look something like the following:

// build.js
const { styles, icons, copy } = require('@texastribune/queso-tools');
const { CSS_MAP, MANIFEST_FILE, SVG_MAP, COPY_MAP } = require('./paths');

async function build() {
  await styles(CSS_MAP, MANIFEST_FILE);
  // OR (use await if you had to glob to get your map)
  // const stylesArr = await CSS_MAP();
  // await styles(stylesArr, MANIFEST_FILE);
  await icons(SVG_MAP);
  await copy(COPY_MAP);
}

build()
  .catch((err) => {
    // eslint-disable-next-line no-console
    console.error(err.message);
    process.exit(1);
  });

Now run node build.js in your local environment to fire the build script.

Publishing

Make sure you're authenticated for npm publishing.

  1. npm login - then follow the prompts
  2. npm run release