Comparing version 1.0.0-silver-3 to 1.0.0-silver-4
{ | ||
"name": "alga-css", | ||
"version": "1.0.0-silver-3", | ||
"version": "1.0.0-silver-4", | ||
"description": "Alga CSS is a scope-first CSS toolkit for quickly mix or compose CSS references and share CSS properties between components", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -57,7 +57,7 @@ const postcss = require('postcss') | ||
const newShorts = shorts[refs[2]] | ||
const refOpt = { | ||
...opts, | ||
property: newShorts | ||
} | ||
for(let newShort of newShorts) { | ||
const refOpt = { | ||
...opts, | ||
property: newShort | ||
} | ||
const declVal = postcss.decl({ prop: camelDash(newShort), value: value(refs[3], refOpt) }) | ||
@@ -113,7 +113,7 @@ newRule.append(declVal) | ||
const newShorts = shorts[refs[1]] | ||
const refOpt = { | ||
...opts, | ||
property: newShorts | ||
} | ||
for(let newShort of newShorts) { | ||
const refOpt = { | ||
...opts, | ||
property: newShort | ||
} | ||
const declVal = postcss.decl({ prop: camelDash(newShort), value: value(refs[2], refOpt) }) | ||
@@ -169,7 +169,7 @@ newRule.append(declVal) | ||
const newShorts = shorts[refs[1]] | ||
const refOpt = { | ||
...opts, | ||
property: newShorts | ||
} | ||
for(let newShort of newShorts) { | ||
const refOpt = { | ||
...opts, | ||
property: newShort | ||
} | ||
const declVal = postcss.decl({ prop: camelDash(newShort), value: value(refs[2], refOpt) }) | ||
@@ -176,0 +176,0 @@ newRule.append(declVal) |
@@ -55,7 +55,12 @@ const glob = require('glob') | ||
for(let ref of Array.from(new Set(extract))) { | ||
newExtract.push(...rules(ref, options)) | ||
newStateExtract = Object.assign({}, atrules(newStateExtract, ref, options)) | ||
if(!options.extract.raws.includes(ref)) { | ||
newExtract.push(...rules(ref, options)) | ||
newStateExtract = Object.assign({}, atrules(newStateExtract, ref, options)) | ||
} | ||
} | ||
return [...newExtract, ...Object.values(newStateExtract)] | ||
return { | ||
raws: Array.from(new Set([...options.extract.raws, ...extract])), | ||
rules: [...newExtract, ...Object.values(newStateExtract)] | ||
} | ||
} |
@@ -44,7 +44,7 @@ const postcss = require('postcss') | ||
const newShorts = shorts[refs[1]] | ||
const refOpt = { | ||
...opts, | ||
property: newShorts | ||
} | ||
for(let newShort of newShorts) { | ||
const refOpt = { | ||
...opts, | ||
property: newShort | ||
} | ||
const declVal = postcss.decl({ prop: camelDash(newShort), value: value(refs[2], refOpt) }) | ||
@@ -90,7 +90,7 @@ newRule.append(declVal) | ||
const newShorts = shorts[refs[0]] | ||
const refOpt = { | ||
...opts, | ||
property: newShorts | ||
} | ||
for(let newShort of newShorts) { | ||
const refOpt = { | ||
...opts, | ||
property: newShort | ||
} | ||
const declVal = postcss.decl({ prop: camelDash(newShort), value: value(refs[1], refOpt) }) | ||
@@ -97,0 +97,0 @@ newRule.append(declVal) |
@@ -22,3 +22,3 @@ // Configs | ||
components: {}, | ||
extract: [] | ||
extract: {raws: [], rules: []} | ||
} | ||
@@ -28,3 +28,3 @@ | ||
config.components = component(options?.src, opts) | ||
config.extract = extraction(options?.extract, opts) | ||
config.extract = extraction(options?.extract, {...opts, extract: config.extract}) | ||
@@ -53,9 +53,9 @@ if(options?.plugins && Number(options?.plugins.length) >= 1) { | ||
if(param === 'refresh') { | ||
config.extract = extraction(options?.extract, opts) | ||
config.extract = extraction(options?.extract, {...opts, extract: config.extract}) | ||
} | ||
else if(param === 'force') { | ||
config.extract = extraction(options?.extract, opts) | ||
config.extract = extraction(options?.extract, {...opts, extract: config.extract}) | ||
if(config.extract.length >= 1) { | ||
root.append(...config.extract) | ||
if(config.extract.rules.length >= 1) { | ||
root.append(...config.extract.rules) | ||
} | ||
@@ -69,3 +69,3 @@ } | ||
if(name === 'base') { | ||
config.extract = extraction(options?.extract, opts) | ||
config.extract = extraction(options?.extract, {...opts, extract: config.extract}) | ||
} | ||
@@ -104,4 +104,4 @@ if(param.includes('.')) { | ||
if(config.extract.length >= 1) { | ||
root.append(...config.extract) | ||
if(config.extract.rules.length >= 1) { | ||
root.append(...config.extract.rules) | ||
} | ||
@@ -108,0 +108,0 @@ |
116932
1484