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

jsass-vars

v2.1.1

Published

A module to compile Javascript modules into valid scss variable files and a coresponding combined javascript file for use in the browser

Downloads

5

Readme

Build Status NPM version

JSass Vars

JSass Vars allows you to defined your scss or sass varibles as a javascript object created from one or more JavaScript modules. JSass Vars will create a valid sass/scss variables file from the object create by the src modules. It also creates a valid JacaScript module with UMD wrapped which will return an object containing all your variables and values for use in your JS scripts. In the browser with out AMD it will create a single global object containing the varibels.

Functions have a special meaning in jSass. When constructing the js and scss files jSass checks if the value is a function. If the value is a function it is executed and the return value is "de-refrenced". This is used to be able to refrence previously defined variables. jSass expects the return value from functions to be a string in the form of "module.property".

Example:

a.js

module.exports = {
	foo: {
		value: "bar"
	}
};

b.js

module.exports = {
	baz: {
		value: () => "a.foo"
	}
};

output.js

module.exports = {
	a: {
		foo: {
			value: "bar"
		}
	},
	b: {
		baz: {
			value: "bar"
		}
	}
};

output.scss

$foo: bar;
$baz: $foo;

Note

The recomended syntax for basic de-refrencing is to use an ES6 arrow function for easy readability

prop: () => "module.prop"

Usage

Node Module

var jsass = require( "jsass.js" );

var output = jsass( src [,options] );

Returns an object with js, and scss properties containing a JavaScript Object and a sass string respectively

Command line

jsass src [, option1 ] [, option2 ]

src ( Required )

Type: String|Array

Accepts any globing pattern or an array of patterns. Use an array if your files are order dependant.

Options

dest

Type: String Default value: undefined Command Line: -d, --dest

If set the scss output files will be saved here.

js

Type: String Default value: same as dest replacing .scss with .js Command Line: -j, --js

If set the js output files will be saved here.

global

Type: String Default value: "sassVars" Command Line: -g, --global

Global namespace in browser enviroments.

namespace

Type: String Default value: `` Command Line: -n, --namespace

namespace to prepend to all variable names in scss file

module

Type: Boolean Default value: false Command Line: -m, --module

To prepend module name to varible names in scss file

headers

Type: Boolean Default value: true Command Line: -h, --headers

Output module names as heads in scss file

template

Type: Boolean Default value: true Command Line: -t, --template

Path to custom template file if true it uses the default template