forgecss 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +5 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -14,9 +14,10 @@ const DEFAULT_OPTIONS = {
|
|
|
14
14
|
output: null
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export default function forgecss(options = {
|
|
17
|
+
export default function forgecss(options = { source: null, output: null, mapping: {} }) {
|
|
18
18
|
const config = { ...DEFAULT_OPTIONS };
|
|
19
19
|
|
|
20
|
+
config.source = options.source || DEFAULT_OPTIONS.source;
|
|
20
21
|
config.mapping = Object.assign({}, DEFAULT_OPTIONS.mapping, options.mapping || {});
|
|
21
22
|
config.output = options.output || DEFAULT_OPTIONS.output;
|
|
22
23
|
|
|
@@ -47,7 +48,7 @@ export default function forgecss(options = { styles: {}, ui: {}, mapping: {}, ou
|
|
|
47
48
|
// fetching the declarations
|
|
48
49
|
try {
|
|
49
50
|
if (lookAtPath) {
|
|
50
|
-
if (config.declarationsMatch.includes(lookAtPath.split(
|
|
51
|
+
if (config.declarationsMatch.includes(lookAtPath.split(".").pop().toLowerCase())) {
|
|
51
52
|
deleteDeclarations(lookAtPath);
|
|
52
53
|
await extractDeclarations(lookAtPath);
|
|
53
54
|
}
|
|
@@ -57,13 +58,13 @@ export default function forgecss(options = { styles: {}, ui: {}, mapping: {}, ou
|
|
|
57
58
|
await extractDeclarations(file);
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
|
-
} catch(err) {
|
|
61
|
+
} catch (err) {
|
|
61
62
|
console.error(`forgecss: error extracting declarations: ${err}`);
|
|
62
63
|
}
|
|
63
64
|
// generating the output CSS
|
|
64
65
|
try {
|
|
65
66
|
await generateOutputCSS(config);
|
|
66
|
-
} catch(err) {
|
|
67
|
+
} catch (err) {
|
|
67
68
|
console.error(`forgecss: error generating output CSS: ${err}`);
|
|
68
69
|
}
|
|
69
70
|
}
|