Skip to content

Commit acb75ba

Browse files
committed
easy enough to replace define with value
1 parent 8c3b6bf commit acb75ba

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var createImportedName = options && options.createImportedName || function (impo
2828
exports['default'] = function (css) {
2929
/* Find any local let rules and store them*/
3030
var translations = {};
31-
css.walkAtRules(/^define$/, function (atRule) {
31+
css.walkAtRules(/^value$/, function (atRule) {
3232
var matches = undefined;
3333
while (matches = matchLet.exec(atRule.params)) {
3434
var _matches = matches;
@@ -56,7 +56,7 @@ exports['default'] = function (css) {
5656

5757
/* Find imports and insert ICSS tmp vars */
5858
var importAliases = [];
59-
css.walkAtRules(/^import(-define)?$/, function (atRule) {
59+
css.walkAtRules(/^import(-value)?$/, function (atRule) {
6060
var matches = matchImports.exec(atRule.params);
6161
if (matches) {
6262
var _matches3 = _slicedToArray(matches, 3);

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let createImportedName = options && options.createImportedName || ((importName/*
1111
export default css => {
1212
/* Find any local let rules and store them*/
1313
let translations = {}
14-
css.walkAtRules(/^define$/, atRule => {
14+
css.walkAtRules(/^value$/, atRule => {
1515
let matches
1616
while (matches = matchLet.exec(atRule.params)) {
1717
let [/*match*/, key, value] = matches
@@ -31,7 +31,7 @@ export default css => {
3131

3232
/* Find imports and insert ICSS tmp vars */
3333
let importAliases = []
34-
css.walkAtRules(/^import(-define)?$/, atRule => {
34+
css.walkAtRules(/^import(-value)?$/, atRule => {
3535
let matches = matchImports.exec(atRule.params)
3636
if (matches) {
3737
let [/*match*/, aliases, path] = matches

test/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ describe('constants', () => {
1616
})
1717

1818
it('should export a constant', () => {
19-
test('@define red blue;', ':export {\n red: blue\n}')
19+
test('@value red blue;', ':export {\n red: blue\n}')
2020
})
2121

2222
it('should export a more complex constant', () => {
23-
test('@define small (max-width: 599px);', ':export {\n small: (max-width: 599px)\n}')
23+
test('@value small (max-width: 599px);', ':export {\n small: (max-width: 599px)\n}')
2424
})
2525

2626
it('should replace constants within the file', () => {
27-
test('@define blue red; .foo { color: blue; }', ':export {\n blue: red;\n}\n.foo { color: red; }')
27+
test('@value blue red; .foo { color: blue; }', ':export {\n blue: red;\n}\n.foo { color: red; }')
2828
})
2929

3030
it('should import a simple constant', () => {
@@ -54,14 +54,14 @@ describe('constants', () => {
5454

5555
it('should import from a definition', () => {
5656
test(
57-
'@define colors: "./colors.css"; @import red from colors;',
57+
'@value colors: "./colors.css"; @import red from colors;',
5858
':export {\n colors: "./colors.css"\n}\n' +
5959
':import("./colors.css") {\n i__const_red_5: red\n}'
6060
)
6161
})
6262

63-
it('should import a simple constant with import-define', () => {
64-
test('@import-define red from "./colors.css";', ':import("./colors.css") {\n i__const_red_6: red\n}')
63+
it('should import a simple constant with import-value', () => {
64+
test('@import-value red from "./colors.css";', ':import("./colors.css") {\n i__const_red_6: red\n}')
6565
})
6666
})
6767

0 commit comments

Comments
 (0)