postcss-local-constants
Advanced tools
Comparing version 0.0.6 to 0.1.0
@@ -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. |
@@ -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 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7277
1