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 🙏

© 2026 – Pkg Stats / Ryan Hefner

stencil-plugin-tss

v2.0.1

Published

The Stencil CSS in TS Plugin

Readme

stencil-plugin-tss

Repo based on @stencil/sass

This package is used to transpile .ts files to css styles. It is optimized for a Stencil build, but may work in other environments too.

First, npm install within the project:

npm install stencil-plugin-tss --save-dev

Next, within the project's rollup.config.js or stencil.config.js file, import the plugin and add it to the config's plugins config:

stencil.config.ts

import { Config } from '@stencil/core';
import { tss } from 'stencil-plugin-tss';

export const config: Config = {
  plugins: [tss(options)]
};

The plugin will start transpiling .ts files as soon as it is initialized. The transpiled files will be read by the transform hook to generate css styles.

Options

options.logCssErrors boolean, default: true

This will toggle the output of debugging information. There'll be hints displayed in the console if the compiled styles are faulty.

options.tempFolder string, default: "./node_modules/.tssTemp"

Specify a folder in which to output transpiled .ts files. There'll be cjs modules generated into this folder - this is not the final output of the plugin and will be deleted in the generateBundle hook.

options.stylesGlob string, default: "**/*.styles.ts"

Pass a glob that resolves to every .ts file you want to use as styles.

options.rootDir string, default: process.cwd()

Will be used as root for globbing.

options.outputGenerator function, default: output to stencil inMemory fs

Pass a function to specify what to do with the transformation results. Function signature: (fileName: string, results: d.PluginTransformResults, context?: any) => Promise<any> Context will be the stencil context object passed to the transform hook. Default function looks like this:

async (fileName, results, context) => {
  if (context) {
    return context.fs
      .writeFile(results.id, results.code, {
        inMemoryOnly: true
      })
      .catch((err: any) => {
        console.error(err);
        loadDiagnostic(context, err, fileName);
        results.code = `/**  ts-style error${
          err && err.message ? ': ' + err.message : ''
        }  **/`;
        return results;
      });
  }
  return Promise.resolve();
}

Code Highlighting

For better usability install styled component plugin within your IDE:

You can then use: import { styled } from "stencil-plugin-tss"

And prefix all your template literal CSS strings with styled to get CSS highlighting and IntelliSense.

HMR

For better hot-module-reloading currently the stencil compiler has to be modified slightly.

Run: node node_modules/stencil-plugin-tss/rewriteStencil.js

This will do the necessary modifications. I will open a feature-request in the official Stencil project to make this configurable.

Related