sheetloaf 1.3.0-beta.1 → 1.3.1-beta.1
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/dist/index.js +10 -18
- package/dist/sources.js +25 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -45,13 +45,13 @@ const sass_1 = __importDefault(require("sass"));
|
|
|
45
45
|
const postcss_1 = __importDefault(require("postcss"));
|
|
46
46
|
const configs = __importStar(require("./configs"));
|
|
47
47
|
const fileFinder = __importStar(require("./fileFinder"));
|
|
48
|
+
const sources = __importStar(require("./sources"));
|
|
48
49
|
const sheetloaf = new commander_1.Command();
|
|
49
|
-
sheetloaf.version("1.3.
|
|
50
|
+
sheetloaf.version("1.3.1-beta.1", '-v, --version', 'Print the version of Sheetloaf.');
|
|
50
51
|
let usingStdin = false;
|
|
51
52
|
let postcssConfig = {
|
|
52
53
|
plugins: []
|
|
53
54
|
};
|
|
54
|
-
let sourcesChecker = [];
|
|
55
55
|
sheetloaf
|
|
56
56
|
.arguments('[sources...]')
|
|
57
57
|
.description('📃🍞 Compile Sass to CSS and transform the output using PostCSS, all in one command.')
|
|
@@ -115,15 +115,14 @@ function renderPartially(source, fileName) {
|
|
|
115
115
|
}
|
|
116
116
|
else {
|
|
117
117
|
let partialExistsInSassSources = false;
|
|
118
|
-
|
|
119
|
-
if (
|
|
118
|
+
sources.getChecker().forEach((source) => {
|
|
119
|
+
if (source.containsPartial(fileName)) {
|
|
120
120
|
partialExistsInSassSources = true;
|
|
121
|
-
renderSass(
|
|
121
|
+
renderSass(source.getMain());
|
|
122
122
|
}
|
|
123
|
-
}
|
|
123
|
+
});
|
|
124
124
|
if (partialExistsInSassSources === false) {
|
|
125
|
-
|
|
126
|
-
sourcesChecker.splice(0, sourcesChecker.length);
|
|
125
|
+
sources.clearSourcesChecker();
|
|
127
126
|
renderAllFiles(source);
|
|
128
127
|
}
|
|
129
128
|
}
|
|
@@ -146,7 +145,7 @@ function watch(source) {
|
|
|
146
145
|
})
|
|
147
146
|
.on('add', (added) => {
|
|
148
147
|
console.log(`File added: ${added}`);
|
|
149
|
-
|
|
148
|
+
sources.clearSourcesChecker();
|
|
150
149
|
renderAllFiles(source);
|
|
151
150
|
});
|
|
152
151
|
}
|
|
@@ -160,13 +159,13 @@ function renderSass(fileName) {
|
|
|
160
159
|
const options = configs.generateSassOptionsAsync(sheetloaf.opts());
|
|
161
160
|
const result = yield sass_1.default.compileAsync(fileName, options);
|
|
162
161
|
renderPost(fileName, destination, result);
|
|
163
|
-
addResultToSourcesChecker(fileName, result);
|
|
162
|
+
sources.addResultToSourcesChecker(fileName, result);
|
|
164
163
|
}
|
|
165
164
|
else {
|
|
166
165
|
const options = configs.generateSassOptions(sheetloaf.opts());
|
|
167
166
|
const result = sass_1.default.compile(fileName, options);
|
|
168
167
|
renderPost(fileName, destination, result);
|
|
169
|
-
addResultToSourcesChecker(fileName, result);
|
|
168
|
+
sources.addResultToSourcesChecker(fileName, result);
|
|
170
169
|
}
|
|
171
170
|
}
|
|
172
171
|
catch (e) {
|
|
@@ -308,10 +307,3 @@ function emitSassError(err) {
|
|
|
308
307
|
`;
|
|
309
308
|
return css;
|
|
310
309
|
}
|
|
311
|
-
function addResultToSourcesChecker(fileName, result) {
|
|
312
|
-
for (let i = 0; i < sourcesChecker.length; i++) {
|
|
313
|
-
if (sourcesChecker[i].getAbsoluteMain() === path_1.default.resolve(fileName)) {
|
|
314
|
-
sourcesChecker[i].setSources(result.loadedUrls);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
package/dist/sources.js
CHANGED
|
@@ -3,8 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SassSources = void 0;
|
|
6
|
+
exports.addResultToSourcesChecker = exports.clearSourcesChecker = exports.getChecker = exports.SassSources = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
+
let sourcesChecker = [];
|
|
8
9
|
class SassSources {
|
|
9
10
|
constructor(fileName, sassResult) {
|
|
10
11
|
this.sources = [];
|
|
@@ -39,3 +40,26 @@ class SassSources {
|
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
exports.SassSources = SassSources;
|
|
43
|
+
function getChecker() {
|
|
44
|
+
return sourcesChecker;
|
|
45
|
+
}
|
|
46
|
+
exports.getChecker = getChecker;
|
|
47
|
+
function clearSourcesChecker() {
|
|
48
|
+
sourcesChecker.splice(0, sourcesChecker.length);
|
|
49
|
+
}
|
|
50
|
+
exports.clearSourcesChecker = clearSourcesChecker;
|
|
51
|
+
function addResultToSourcesChecker(fileName, result) {
|
|
52
|
+
let resultExistsInChecker = false;
|
|
53
|
+
let ind = 0;
|
|
54
|
+
while (ind < sourcesChecker.length && resultExistsInChecker === false) {
|
|
55
|
+
if (sourcesChecker[ind].getAbsoluteMain() === path_1.default.resolve(fileName)) {
|
|
56
|
+
sourcesChecker[ind].setSources(result.loadedUrls);
|
|
57
|
+
resultExistsInChecker = true;
|
|
58
|
+
}
|
|
59
|
+
ind = ind + 1;
|
|
60
|
+
}
|
|
61
|
+
if (resultExistsInChecker === false) {
|
|
62
|
+
sourcesChecker.push(new SassSources(fileName, result));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.addResultToSourcesChecker = addResultToSourcesChecker;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sheetloaf",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1-beta.1",
|
|
4
4
|
"description": "freshmade stylesheets for the whole family.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
"fast-glob": "^3.2.11",
|
|
55
55
|
"picocolors": "^1.0.0",
|
|
56
56
|
"picomatch": "^2.3.1",
|
|
57
|
-
"sass": "^1.54.
|
|
57
|
+
"sass": "^1.54.4"
|
|
58
58
|
}
|
|
59
59
|
}
|