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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@server/sass

v0.3.0

Published

Automatically compile SASS to CSS for your server.js project

Downloads

4

Readme

@server/sass

A small plugin to automatically handle SASS and SCSS with server.js. You request /style.css or /style.min.css and this plugin will make sure to either compile it on each request for dev, or once on launch for production.

THIS IS WORKING BUT EXPERIMENTAL right now.

Getting Started

First install the plugin:

npm install @server/sass

Then in your main index.js include it with server.js:

const server = require("server");
const serverSass = require("@server/sass");

// TEMPORARY; this line will change
server.plugins.push(serverSass);

const { get } = server.router;
const { render } = server.reply;

// Render a single route for the homepage
server(get("/", () => render("index.html")));

Then let's create this file. This will be a simple HTML file inside views/index.html:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Sass Demo</title>
    <link rel="stylesheet" href="/style.css" />
  </head>
  <body>
    <h1>Hi there</h1>
    <div>Hello world!</div>
  </body>
</html>

The main important part here is the /style.css. This will be automatically compiled and generated from @server/sass. Finally, let's create some style on style/style.scss:

$background: red;

body {
  div {
    background: $background;
  }
}

ul li:nth-child(3) {
  background: $background;
}

Finally start the server with node . and try the project by opening http://localhost:3000/!

Options

The only option available is the source of the SASS/SCSS, which can be specified as one of either:

// With the default path:
server({ sass: "style/style.scss" });
server({ sass: { source: "style/style.scss" } });

// But it can be anything really:
server({ sass: "style.scss" });
server({ sass: "sass/style.sass" });

The extension can be either .scss or .sass, both will work properly.

The behaviour is a bit different for development and production, but from the front-end point of view you want to just request /style.css or /style.min.css (depending on your preferences).

Demo

Clone this repo:

git clone git@github.com:franciscop/server-sass.git
cd server-sass

Then install the dependencies, enter demo and start the project:

npm install
cd demo
node .

Finally open http://localhost:3000/ to see the styles being rendered.