Comparing version 0.2.2 to 0.2.3
{ | ||
"name": "nocssjs", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "NoCSS -- stop writing CSS, just use Javascript", | ||
@@ -26,4 +26,4 @@ "main": "src/index.js", | ||
"mocha": "^2.5.3", | ||
"mocha-brackets": "0.0.1" | ||
"mocha-brackets": "0.0.2" | ||
} | ||
} |
@@ -14,4 +14,5 @@ const _ = require('lodash'); | ||
(val, key) => _.each( | ||
key.split(','), ks => | ||
toCSSRecursive(val, _.flatten([ns, ks]), result))); | ||
key.split(','), ks => { | ||
toCSSRecursive(val, _.flatten([ns, ks]), result) | ||
})); | ||
_.each( | ||
@@ -33,3 +34,3 @@ _.omitBy(obj, _.isPlainObject), | ||
function render(obj) { | ||
function renderShallow(obj) { | ||
const result = {}; | ||
@@ -50,3 +51,21 @@ toCSSRecursive(obj, [], result); | ||
function render(obj) { | ||
const mediaQueries = _.map( | ||
_.pickBy(obj, (val, key) => { | ||
return key[0] === '@'; | ||
}), | ||
(val, key) => { | ||
return key + ' {\n' + renderShallow(val) + '\n}'; | ||
}).join('\n'); | ||
console.log('media queries are', mediaQueries); | ||
return [ | ||
renderShallow( | ||
_.omitBy(obj, (val, key) => { | ||
return key[0] === '@'; | ||
})), | ||
mediaQueries | ||
].join('\n'); | ||
} | ||
return { render, use }; | ||
}; |
@@ -76,2 +76,13 @@ const assert = require('chai').assert; | ||
], | ||
['Media queries', | ||
['Basic media query', () => { | ||
assert.equal(nocss.render({ | ||
'@media (min-width:400px)': { | ||
'h1': { | ||
'color': 'green', | ||
}, | ||
}, | ||
}), '@media (min-width:400px) {\nh1 {\n color: green;\n}\n}'); | ||
}]], | ||
]; | ||
@@ -78,0 +89,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
29898
19
1143