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

lyonesse

v0.3.1

Published

Need to use the same values in JS and SCSS? Use Lyonesse!

Downloads

7

Readme

Lyonesse

Build Status

Why Lyonesse

When developing front-ends, it's often the case that a color may be used both in the CSS files and in Javascript (with Canvas, SVG...).

Lyonesse goal is to let you have a centralized file for this kind of variable.

Most notably, having a unique file for all the colors used in your web application will ease any future redesign.

See here the specifications of Lyonesse file.

See also gulp-lyonesse to use Lyonesse in your gulp build process.

If you use Sublime Text, download sublime-lyonesse syntax definition file, it provides code highlighting.

Released under MIT License.

Install

npm install --save lyonesse

Lyonesse functions

Callback takes two arguments: err in case of errors, and result for compiled string.

lyonesse.fromString(str, [options], callback)

Parse a Lyonesse string and call back with Js or Scss compiled string.

lyonesse.fromFile(filepath, [options], callback)

Parse a Lyonesse file and call back with Js or Scss compiled string.

lyonesse.parse(str)

Returns a Lyonesse object from a Lyonesse string.

lyonesse.solve(obj, options)

Solve variables inside the Lyonesse file.

lyonesse.toScss(obj, options)

Returns a Scss string from a Lyonesse object, using given options.

lyonesse.toJs(obj, options)

Returns a Js string from a Lyonesse object, using given options.

Example

var lyonesse = require('lyonesse');

lyonesse.fromString('color: #000', function (err, result) {
    if (!!err) {
        return;
    }

    console.log(result); 
    // var color = '#000';
});

Variables in Lyonesse

Since Lyonesse 0.1.2, variables inside Lyonesse are now supported. For example, given this Lyonesse file:

myColor: #234567
otherColor: $myColor

when parsed and solve, the variable otherColor will get the value of myColor so otherColor value is now #234567.

Use the solve option to deactivate this behaviour.

Namespaces

Since Lyonesse 0.1.3, you can use namespaces in Lyonesse files:

my:
    namespace:
        color: #000
    inside: #f00
global: #fff

This will produce the following JavaScript:

var my = {
        namespace: {
            color: '#000'
        },
        inside: '#f00'
    }, 
    global = '#fff';

and the following Scss:

$my-namespace-color: #000;
$my-inside: #f00;
$global: #fff;

Options

  • symbol: default '$' - Specifies prefix of Scss variables
  • target: 'scss' or 'js', default 'js' - Specifies compilation target when using fromFile and fromString functions
  • namespace: default null
  • closure: default false - For JS only, enclose result in a closure (nested namespaces only)
  • solve: default true - Solve or not the variables inside the lyonesse file

Run tests

Requires mocha (npm install -g mocha), then in command line:

$ mocha

Changelog

  • 0.1.0: First version
  • 0.1.1: Add closure option
  • 0.1.2: Variable replacement!
  • 0.1.3: Namespaces!
  • 0.2.0: It's Scss, not Sass dumb
    • Breaking change: rename toSass method to toScss
  • 0.2.1: Fix variables inside namespaces
  • 0.3.0: Rebranding to Lyonesse!