Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-local-constants

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-local-constants - npm Package Compare versions

Comparing version 0.0.6 to 0.1.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 0.1.0
* Interface Tidy. `blue from ~colors` is now `~colors.blue`.
## 0.0.7
* Allow constants to have integers in name (`color1`)
## 0.0.6

@@ -2,0 +8,0 @@ * Referencing module paths is now the same as a `require` - it's relative to the current directory.

8

index.js

@@ -10,3 +10,3 @@ var postcss = require('postcss');

var regex = /((?:[A-z]+))( )(from)(\s+)(~)((?:[A-z]+))/g;
var regex = /~([\w]+)\.([\w]+)/g;

@@ -30,3 +30,3 @@ var getConstants = function(name, path, directory) {

var requiresAction = function(context) {
return context.indexOf(' ~') !== -1;
return !!context.match(regex);
};

@@ -55,4 +55,4 @@

regex.lastIndex = 0;
var constant = matches[1];
var constantSet = matches[matches.length - 1];
var constant = matches[2];
var constantSet = matches[1];

@@ -59,0 +59,0 @@ context = context.replace(require, getValue(constant, constantSet));

{
"name": "postcss-local-constants",
"version": "0.0.6",
"version": "0.1.0",
"description": "PostCSS plugin to process imported constants from a file, removing them from a global scope.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -20,5 +20,5 @@ # PostCSS Local Constants [![Build Status][ci-img]][ci]

```css
~colors: "./constants.json";
~colors: "./constants.js";
.foo {
color: primary from ~colors;
color: ~colors.primary;
}

@@ -48,5 +48,5 @@ ```

```css
~borders: "./constants.json";
~borders: "./constants.js";
.foo {
border: weight from ~borders style from ~borders black;
border: ~borders.weight ~borders.style black;
}

@@ -75,5 +75,5 @@ ```

```css
~queries: "./constants.json";
~queries: "./constants.js";
@media (max-width: maxWidth from ~queries) {
@media (max-width: ~queries.maxWidth) {
color: blue;

@@ -80,0 +80,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc